业务线管理

jg-waiwang-pro
vayne 9 months ago
parent e8fb0d807e
commit 48475a9a22

@ -2,6 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.BusinessLineMapper">
<select id="queryBusinessLineList" resultType="jnpf.entity.BusinessLineEntity">
select * from jg_business_line where 1=1
</select>
</mapper>

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BaseUserEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BaseUserMapper extends BaseMapper<BaseUserEntity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BusinessLineConfigEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BusinessLineConfigMapper extends BaseMapper<BusinessLineConfigEntity> {
}

@ -4,6 +4,8 @@ package jnpf.mapper;
import jnpf.entity.BusinessLineEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* businessLine
* V3.5
@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface BusinessLineMapper extends BaseMapper<BusinessLineEntity> {
List<BusinessLineEntity> queryBusinessLineList();
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BusinessLineSonEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BusinessLineSonMapper extends BaseMapper<BusinessLineSonEntity> {
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.businesslineconfig.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BaseUserService extends IService<BaseUserEntity> {
QueryWrapper<BaseUserEntity> getChild(BusinessLineConfigPagination pagination,QueryWrapper<BaseUserEntity> baseUserQueryWrapper);
}

@ -0,0 +1,39 @@
package jnpf.service;
import jnpf.model.businesslineconfig.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BusinessLineConfigService extends IService<BusinessLineConfigEntity> {
List<BusinessLineConfigEntity> getList(BusinessLineConfigPagination businessLineConfigPagination);
List<BusinessLineConfigEntity> getTypeList(BusinessLineConfigPagination businessLineConfigPagination,String dataType);
BusinessLineConfigEntity getInfo(String id);
void delete(BusinessLineConfigEntity entity);
void create(BusinessLineConfigEntity entity);
boolean update(String id, BusinessLineConfigEntity entity);
//子表方法
//副表数据方法
BusinessLineSonEntity getBusinessLineSon(String id);
BaseUserEntity getBaseUser(String id);
String checkForm(BusinessLineConfigForm form,int i);
void saveOrUpdate(BusinessLineConfigForm businessLineConfigForm,String id, boolean isSave) throws Exception;
}

@ -44,4 +44,6 @@ public interface BusinessLineService extends IService<BusinessLineEntity> {
void saveOrUpdate(BusinessLineForm businessLineForm,String id, boolean isSave) throws Exception;
List<BusinessLineEntity> queryBusinessLineListInfo();
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.businesslineconfig.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
public interface BusinessLineSonService extends IService<BusinessLineSonEntity> {
QueryWrapper<BusinessLineSonEntity> getChild(BusinessLineConfigPagination pagination,QueryWrapper<BusinessLineSonEntity> businessLineSonQueryWrapper);
}

@ -0,0 +1,61 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BaseUserMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.businesslineconfig.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
@Service
public class BaseUserServiceImpl extends ServiceImpl<BaseUserMapper, BaseUserEntity> implements BaseUserService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BaseUserEntity> getChild(BusinessLineConfigPagination pagination, QueryWrapper<BaseUserEntity> baseUserQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BusinessLineConfigConstant.getColumnData():BusinessLineConfigConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
if(!isPc){
}
return baseUserQueryWrapper;
}
}

@ -0,0 +1,454 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BusinessLineConfigMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.businesslineconfig.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
@Service
public class BusinessLineConfigServiceImpl extends ServiceImpl<BusinessLineConfigMapper, BusinessLineConfigEntity> implements BusinessLineConfigService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BusinessLineSonService businessLineSonService;
@Autowired
private BaseUserService baseUserService;
@Override
public List<BusinessLineConfigEntity> getList(BusinessLineConfigPagination businessLineConfigPagination){
return getTypeList(businessLineConfigPagination,businessLineConfigPagination.getDataType());
}
/** 列表查询 */
@Override
public List<BusinessLineConfigEntity> getTypeList(BusinessLineConfigPagination businessLineConfigPagination,String dataType){
String userId=userProvider.get().getUserId();
List<String> AllIdList =new ArrayList();
List<List<String>> intersectionList =new ArrayList<>();
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String columnData = !isPc ? BusinessLineConfigConstant.getAppColumnData() : BusinessLineConfigConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int businessLineConfigNum =0;
QueryWrapper<BusinessLineConfigEntity> businessLineConfigQueryWrapper=new QueryWrapper<>();
int businessLineSonNum =0;
QueryWrapper<BusinessLineSonEntity> businessLineSonQueryWrapper=new QueryWrapper<>();
int baseUserNum =0;
QueryWrapper<BaseUserEntity> baseUserQueryWrapper=new QueryWrapper<>();
long businessLineSoncount = businessLineSonService.count();
long baseUsercount = baseUserService.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(businessLineConfigPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = businessLineConfigPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<BusinessLineConfigEntity> businessLineConfigSuperWrapper = new QueryWrapper<>();
businessLineConfigSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(businessLineConfigSuperWrapper,BusinessLineConfigEntity.class,queryJson,"0"));
int businessLineConfigNum1 = businessLineConfigSuperWrapper.getExpression().getNormal().size();
if (businessLineConfigNum1>0){
List<String> businessLineConfigList =this.list(businessLineConfigSuperWrapper).stream().map(BusinessLineConfigEntity::getId).collect(Collectors.toList());
allSuperList.addAll(businessLineConfigList);
intersectionSuperList.add(businessLineConfigList);
superNum++;
}
String businessLineSonTable = "jg_business_line";
boolean businessLineSonHasSql = queryJson.contains(businessLineSonTable);
List<String> businessLineSonList = generaterSwapUtil.selectIdsByChildCondition(BusinessLineConfigConstant.getTableList(), businessLineSonTable , queryJson, null);
if (businessLineSonHasSql){
allSuperList.addAll(businessLineSonList);
intersectionSuperList.add(businessLineSonList);
superNum++;
}
String baseUserTable = "base_user";
boolean baseUserHasSql = queryJson.contains(baseUserTable);
List<String> baseUserList = generaterSwapUtil.selectIdsByChildCondition(BusinessLineConfigConstant.getTableList(), baseUserTable , queryJson, null);
if (baseUserHasSql){
allSuperList.addAll(baseUserList);
intersectionSuperList.add(baseUserList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or
if(superOp.equalsIgnoreCase("and")){
allSuperIDlist = generaterSwapUtil.getIntersection(intersectionSuperList);
}else{
allSuperIDlist = allSuperList;
}
}
List<String> allRuleIDlist = new ArrayList<>();
String ruleOp ="";
if (ObjectUtil.isNotEmpty(ruleJson)){
List<String> allRuleList = new ArrayList<>();
List<List<String>> intersectionRuleList = new ArrayList<>();
SuperJsonModel ruleJsonModel = JsonUtil.getJsonToBean(ruleJson, SuperJsonModel.class);
int ruleNum = 0;
QueryWrapper<BusinessLineConfigEntity> businessLineConfigSuperWrapper = new QueryWrapper<>();
businessLineConfigSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(businessLineConfigSuperWrapper,BusinessLineConfigEntity.class,ruleJson,"0"));
int businessLineConfigNum1 = businessLineConfigSuperWrapper.getExpression().getNormal().size();
if (businessLineConfigNum1>0){
List<String> businessLineConfigList =this.list(businessLineConfigSuperWrapper).stream().map(BusinessLineConfigEntity::getId).collect(Collectors.toList());
allRuleList.addAll(businessLineConfigList);
intersectionRuleList.add(businessLineConfigList);
ruleNum++;
}
String businessLineSonTable = "jg_business_line";
boolean businessLineSonHasSql = ruleJson.contains(businessLineSonTable);
List<String> businessLineSonList = generaterSwapUtil.selectIdsByChildCondition(BusinessLineConfigConstant.getTableList(), businessLineSonTable , ruleJson, null);
if (businessLineSonHasSql){
allRuleList.addAll(businessLineSonList);
intersectionRuleList.add(businessLineSonList);
ruleNum++;
}
String baseUserTable = "base_user";
boolean baseUserHasSql = ruleJson.contains(baseUserTable);
List<String> baseUserList = generaterSwapUtil.selectIdsByChildCondition(BusinessLineConfigConstant.getTableList(), baseUserTable , ruleJson, null);
if (baseUserHasSql){
allRuleList.addAll(baseUserList);
intersectionRuleList.add(baseUserList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object businessLineConfigObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLineConfigQueryWrapper,BusinessLineConfigEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLineConfigObj)){
return new ArrayList<>();
} else {
businessLineConfigQueryWrapper = (QueryWrapper<BusinessLineConfigEntity>)businessLineConfigObj;
if( businessLineConfigQueryWrapper.getExpression().getNormal().size()>0){
businessLineConfigNum++;
}
}
Object businessLineSonObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLineSonQueryWrapper,BusinessLineSonEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLineSonObj)){
return new ArrayList<>();
} else {
businessLineSonQueryWrapper = (QueryWrapper<BusinessLineSonEntity>)businessLineSonObj;
if( businessLineSonQueryWrapper.getExpression().getNormal().size()>0){
businessLineSonNum++;
}
}
Object baseUserObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(baseUserQueryWrapper,BaseUserEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(baseUserObj)){
return new ArrayList<>();
} else {
baseUserQueryWrapper = (QueryWrapper<BaseUserEntity>)baseUserObj;
if( baseUserQueryWrapper.getExpression().getNormal().size()>0){
baseUserNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object businessLineConfigObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLineConfigQueryWrapper,BusinessLineConfigEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLineConfigObj)){
return new ArrayList<>();
} else {
businessLineConfigQueryWrapper = (QueryWrapper<BusinessLineConfigEntity>)businessLineConfigObj;
if( businessLineConfigQueryWrapper.getExpression().getNormal().size()>0){
businessLineConfigNum++;
}
}
Object businessLineSonObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLineSonQueryWrapper,BusinessLineSonEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLineSonObj)){
return new ArrayList<>();
} else {
businessLineSonQueryWrapper = (QueryWrapper<BusinessLineSonEntity>)businessLineSonObj;
if( businessLineSonQueryWrapper.getExpression().getNormal().size()>0){
businessLineSonNum++;
}
}
Object baseUserObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(baseUserQueryWrapper,BaseUserEntity.class,businessLineConfigPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(baseUserObj)){
return new ArrayList<>();
} else {
baseUserQueryWrapper = (QueryWrapper<BaseUserEntity>)baseUserObj;
if( baseUserQueryWrapper.getExpression().getNormal().size()>0){
baseUserNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name())){
businessLineSonNum++;
String value = businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name() instanceof List ?
JsonUtil.getObjectToString(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name()) :
String.valueOf(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name());
businessLineSonQueryWrapper.lambda().like(BusinessLineSonEntity::getName,value);
}
if(ObjectUtil.isNotEmpty(businessLineConfigPagination.getJnpf_base_user_jnpf_realName())){
baseUserNum++;
String value = businessLineConfigPagination.getJnpf_base_user_jnpf_realName() instanceof List ?
JsonUtil.getObjectToString(businessLineConfigPagination.getJnpf_base_user_jnpf_realName()) :
String.valueOf(businessLineConfigPagination.getJnpf_base_user_jnpf_realName());
baseUserQueryWrapper.lambda().like(BaseUserEntity::getRealName,value);
}
if(ObjectUtil.isNotEmpty(businessLineConfigPagination.getJnpf_base_user_jnpf_lastLogTime())){
baseUserNum++;
List LastLogTimeList = JsonUtil.getJsonToList(businessLineConfigPagination.getJnpf_base_user_jnpf_lastLogTime(),String.class);
Long fir = Long.valueOf(String.valueOf(LastLogTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(LastLogTimeList.get(1)));
baseUserQueryWrapper.lambda().ge(BaseUserEntity::getLastLogTime, new Date(fir))
.le(BaseUserEntity::getLastLogTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
}
if(!isPc){
if(ObjectUtil.isNotEmpty(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name())){
businessLineSonNum++;
String value = businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name() instanceof List ?
JsonUtil.getObjectToString(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name()) :
String.valueOf(businessLineConfigPagination.getJnpf_jg_business_line_jnpf_name());
businessLineSonQueryWrapper.lambda().like(BusinessLineSonEntity::getName,value);
}
}
if(businessLineSonNum>0){
List<String> businessLineSonIdList = businessLineSonService.list(businessLineSonQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getId())).map(t->t.getId()).collect(Collectors.toList());
long count = businessLineSonService.count();
if (count>0){
intersectionList.add(businessLineSonIdList);
}
AllIdList.addAll(businessLineSonIdList);
}
total+=businessLineSonNum;
if(baseUserNum>0){
List<String> baseUserIdList = baseUserService.list(baseUserQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getId())).map(t->t.getId()).collect(Collectors.toList());
long count = baseUserService.count();
if (count>0){
intersectionList.add(baseUserIdList);
}
AllIdList.addAll(baseUserIdList);
}
total+=baseUserNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
businessLineConfigQueryWrapper.lambda().in(BusinessLineConfigEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
businessLineConfigQueryWrapper.lambda().and(t->t.in(BusinessLineConfigEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
businessLineConfigQueryWrapper.lambda().and(t->t.in(BusinessLineConfigEntity::getId, finalAllRuleIDlist));
}
//假删除标志
businessLineConfigQueryWrapper.lambda().isNull(BusinessLineConfigEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(businessLineConfigPagination.getSidx())){
businessLineConfigQueryWrapper.lambda().orderByDesc(BusinessLineConfigEntity::getId);
}else{
try {
String sidx = businessLineConfigPagination.getSidx();
String[] strs= sidx.split("_name");
BusinessLineConfigEntity businessLineConfigEntity = new BusinessLineConfigEntity();
Field declaredField = businessLineConfigEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
businessLineConfigQueryWrapper="asc".equals(businessLineConfigPagination.getSort().toLowerCase())?businessLineConfigQueryWrapper.orderByAsc(value):businessLineConfigQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<BusinessLineConfigEntity> page=new Page<>(businessLineConfigPagination.getCurrentPage(), businessLineConfigPagination.getPageSize());
IPage<BusinessLineConfigEntity> userIPage=this.page(page, businessLineConfigQueryWrapper);
return businessLineConfigPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<BusinessLineConfigEntity> list = new ArrayList();
return businessLineConfigPagination.setData(list, list.size());
}
}else{
return this.list(businessLineConfigQueryWrapper);
}
}
@Override
public BusinessLineConfigEntity getInfo(String id){
QueryWrapper<BusinessLineConfigEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(BusinessLineConfigEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(BusinessLineConfigEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, BusinessLineConfigEntity entity){
return this.updateById(entity);
}
@Override
public void delete(BusinessLineConfigEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** BusinessLineSon副表方法 */
@Override
public BusinessLineSonEntity getBusinessLineSon(String id){
QueryWrapper<BusinessLineSonEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BusinessLineSonEntity::getId, id);
return businessLineSonService.getOne(queryWrapper);
}
/** BaseUser副表方法 */
@Override
public BaseUserEntity getBaseUser(String id){
QueryWrapper<BaseUserEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BaseUserEntity::getId, id);
return baseUserService.getOne(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(BusinessLineConfigForm form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
//副表字段验证
return countRecover;
}
/**
* ()
* @param id
* @param businessLineConfigForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(BusinessLineConfigForm businessLineConfigForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
businessLineConfigForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(BusinessLineConfigConstant.getFormData(),businessLineConfigForm),BusinessLineConfigForm.class);
BusinessLineConfigEntity entity = JsonUtil.getJsonToBean(businessLineConfigForm, BusinessLineConfigEntity.class);
if(isSave){
String mainId = id ;
entity.setId(mainId);
entity.setFlowId(businessLineConfigForm.getFlowId());
entity.setVersion(0);
}else{
entity.setFlowId(businessLineConfigForm.getFlowId());
}
this.saveOrUpdate(entity);
//jg_business_line副表数据新增修改
Map<String, Object> BusinessLineSonMap = generaterSwapUtil.getMastTabelData(businessLineConfigForm,"jg_business_line");
BusinessLineSonEntity jg_business_lineentity = JsonUtil.getJsonToBean(BusinessLineSonMap,BusinessLineSonEntity.class);
//自动生成的字段
if(isSave){
jg_business_lineentity.setId(entity.getBusinessLineId());
jg_business_lineentity.setId(RandomUtil.uuId());
}else{
QueryWrapper<BusinessLineSonEntity> queryWrapperBusinessLineSon =new QueryWrapper<>();
queryWrapperBusinessLineSon.lambda().eq(BusinessLineSonEntity::getId,entity.getBusinessLineId());
BusinessLineSonEntity jg_business_lineOneEntity= businessLineSonService.getOne(queryWrapperBusinessLineSon);
jg_business_lineentity.setId(jg_business_lineOneEntity.getId());
jg_business_lineentity.setId(entity.getBusinessLineId());
}
businessLineSonService.saveOrUpdate(jg_business_lineentity);
//base_user副表数据新增修改
Map<String, Object> BaseUserMap = generaterSwapUtil.getMastTabelData(businessLineConfigForm,"base_user");
BaseUserEntity base_userentity = JsonUtil.getJsonToBean(BaseUserMap,BaseUserEntity.class);
//自动生成的字段
if(isSave){
base_userentity.setId(entity.getUserId());
base_userentity.setId(RandomUtil.uuId());
}else{
QueryWrapper<BaseUserEntity> queryWrapperBaseUser =new QueryWrapper<>();
queryWrapperBaseUser.lambda().eq(BaseUserEntity::getId,entity.getUserId());
BaseUserEntity base_userOneEntity= baseUserService.getOne(queryWrapperBaseUser);
base_userentity.setId(base_userOneEntity.getId());
base_userentity.setId(entity.getUserId());
}
baseUserService.saveOrUpdate(base_userentity);
}
}

@ -30,6 +30,9 @@ import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
import javax.annotation.Resource;
/**
*
* businessLine
@ -52,6 +55,8 @@ public class BusinessLineServiceImpl extends ServiceImpl<BusinessLineMapper, Bus
private BusinessAddressService businessAddressService;
@Autowired
private BusinessCargoService businessCargoService;
@Resource
private BusinessLineMapper businessLineMapper;
@Override
public List<BusinessLineEntity> getList(BusinessLinePagination businessLinePagination){
return getTypeList(businessLinePagination,businessLinePagination.getDataType());
@ -645,4 +650,9 @@ public class BusinessLineServiceImpl extends ServiceImpl<BusinessLineMapper, Bus
}
}
}
@Override
public List<BusinessLineEntity> queryBusinessLineListInfo() {
return businessLineMapper.queryBusinessLineList();
}
}

@ -0,0 +1,61 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BusinessLineSonMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.businesslineconfig.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* businessLineConfig
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
@Service
public class BusinessLineSonServiceImpl extends ServiceImpl<BusinessLineSonMapper, BusinessLineSonEntity> implements BusinessLineSonService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BusinessLineSonEntity> getChild(BusinessLineConfigPagination pagination, QueryWrapper<BusinessLineSonEntity> businessLineSonQueryWrapper){
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BusinessLineConfigConstant.getColumnData():BusinessLineConfigConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
if(!isPc){
}
return businessLineSonQueryWrapper;
}
}

@ -0,0 +1,463 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.businesslineconfig.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* businessLineConfig
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Slf4j
@RestController
@Tag(name = "businessLineConfig" , description = "scm")
@RequestMapping("/api/scm/BusinessLineConfig")
public class BusinessLineConfigController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BusinessLineConfigService businessLineConfigService;
@Autowired
private BusinessLineSonService businessLineSonService;
@Autowired
private BaseUserService baseUserService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param businessLineConfigPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody BusinessLineConfigPagination businessLineConfigPagination)throws IOException{
List<BusinessLineConfigEntity> list= businessLineConfigService.getList(businessLineConfigPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (BusinessLineConfigEntity entity : list) {
Map<String, Object> businessLineConfigMap=JsonUtil.entityToMap(entity);
businessLineConfigMap.put("id", businessLineConfigMap.get("id"));
//副表数据
BusinessLineSonEntity businessLineSonEntity = businessLineConfigService.getBusinessLineSon(entity.getId());
if(ObjectUtil.isNotEmpty(businessLineSonEntity)){
Map<String, Object> businessLineSonMap=JsonUtil.entityToMap(businessLineSonEntity);
for(String key:businessLineSonMap.keySet()){
businessLineConfigMap.put("jnpf_jg_business_line_jnpf_"+key,businessLineSonMap.get(key));
}
}
BaseUserEntity baseUserEntity = businessLineConfigService.getBaseUser(entity.getId());
if(ObjectUtil.isNotEmpty(baseUserEntity)){
Map<String, Object> baseUserMap=JsonUtil.entityToMap(baseUserEntity);
for(String key:baseUserMap.keySet()){
businessLineConfigMap.put("jnpf_base_user_jnpf_"+key,baseUserMap.get(key));
}
}
//子表数据
realList.add(businessLineConfigMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, BusinessLineConfigConstant.getFormData(), BusinessLineConfigConstant.getColumnData(), businessLineConfigPagination.getModuleId(),false);
//流程状态添加
for(Map<String, Object> vo:realList){
FlowTaskEntity flowTaskEntity = generaterSwapUtil.getInfoSubmit(String.valueOf(vo.get("id")), FlowTaskEntity::getStatus);
if (flowTaskEntity!=null){
vo.put("flowState",flowTaskEntity.getStatus());
}else{
vo.put("flowState",null);
}
//添加流程id
String flowId="";
if(vo.get("flowid")!=null){
flowId = String.valueOf(vo.get("flowid"));
}
if(vo.get("flowid".toUpperCase())!=null){
flowId = String.valueOf(vo.get("flowid".toUpperCase()));
}
if(StringUtil.isNotEmpty(flowId)){
vo.put("flowId" ,flowId);
}
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(businessLineConfigPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param businessLineConfigForm
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid BusinessLineConfigForm businessLineConfigForm) {
String b = businessLineConfigService.checkForm(businessLineConfigForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
businessLineConfigService.saveOrUpdate(businessLineConfigForm, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody BusinessLineConfigPagination businessLineConfigPagination) throws IOException {
if (StringUtil.isEmpty(businessLineConfigPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<BusinessLineConfigEntity> list= businessLineConfigService.getList(businessLineConfigPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (BusinessLineConfigEntity entity : list) {
Map<String, Object> businessLineConfigMap=JsonUtil.entityToMap(entity);
businessLineConfigMap.put("id", businessLineConfigMap.get("id"));
//副表数据
BusinessLineSonEntity businessLineSonEntity = businessLineConfigService.getBusinessLineSon(entity.getId());
if(ObjectUtil.isNotEmpty(businessLineSonEntity)){
Map<String, Object> businessLineSonMap=JsonUtil.entityToMap(businessLineSonEntity);
for(String key:businessLineSonMap.keySet()){
businessLineConfigMap.put("jnpf_jg_business_line_jnpf_"+key,businessLineSonMap.get(key));
}
}
BaseUserEntity baseUserEntity = businessLineConfigService.getBaseUser(entity.getId());
if(ObjectUtil.isNotEmpty(baseUserEntity)){
Map<String, Object> baseUserMap=JsonUtil.entityToMap(baseUserEntity);
for(String key:baseUserMap.keySet()){
businessLineConfigMap.put("jnpf_base_user_jnpf_"+key,baseUserMap.get(key));
}
}
//子表数据
realList.add(businessLineConfigMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, BusinessLineConfigConstant.getFormData(), BusinessLineConfigConstant.getColumnData(), businessLineConfigPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(businessLineConfigPagination.getSelectKey())?businessLineConfigPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "jnpf_jg_business_line_jnpf_name" :
entitys.add(new ExcelExportEntity("业务线名称" ,"jnpf_jg_business_line_jnpf_name"));
break;
case "jnpf_base_user_jnpf_realName" :
entitys.add(new ExcelExportEntity("姓名" ,"jnpf_base_user_jnpf_realName"));
break;
case "jnpf_base_user_jnpf_enabledMark" :
entitys.add(new ExcelExportEntity("帐号状态" ,"jnpf_base_user_jnpf_enabledMark"));
break;
case "jnpf_base_user_jnpf_mobilePhone" :
entitys.add(new ExcelExportEntity("手机" ,"jnpf_base_user_jnpf_mobilePhone"));
break;
case "jnpf_base_user_jnpf_lastLogTime" :
entitys.add(new ExcelExportEntity("最后登录" ,"jnpf_base_user_jnpf_lastLogTime"));
break;
case "jnpf_base_user_jnpf_creatorTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"jnpf_base_user_jnpf_creatorTime"));
break;
case "jnpf_base_user_jnpf_lastModifyTime" :
entitys.add(new ExcelExportEntity("修改时间" ,"jnpf_base_user_jnpf_lastModifyTime"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(BusinessLineConfigConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param ids
* @return
*/
@DeleteMapping("/batchRemove")
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
List<String> columnIdList = new ArrayList<>(20);
int i =0;
String errInfo = "";
for (String allId : idList){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(allId, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity==null){
columnIdList.add(allId);
this.delete(allId);
}else if (taskEntity.getStatus().equals(0) || taskEntity.getStatus().equals(4)){
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
columnIdList.add(allId);
this.delete(allId);
i++;
} catch (WorkFlowException e) {
errInfo = e.getMessage();
e.printStackTrace();
}
}
}
if (i == 0 && columnIdList.size()==0){
return ActionResult.fail("流程已发起,无法删除");
}
if (StringUtil.isNotEmpty(errInfo)){
return ActionResult.fail(errInfo);
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param businessLineConfigForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid BusinessLineConfigForm businessLineConfigForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
businessLineConfigForm.setId(id);
if (!isImport) {
String b = businessLineConfigService.checkForm(businessLineConfigForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
BusinessLineConfigEntity entity= businessLineConfigService.getInfo(id);
if(entity!=null){
try{
businessLineConfigService.saveOrUpdate(businessLineConfigForm,id,false);
}catch(Exception e){
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
*
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
BusinessLineConfigEntity entity= businessLineConfigService.getInfo(id);
if(entity!=null){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(id, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity != null) {
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
} catch (WorkFlowException e) {
e.printStackTrace();
}
}
//假删除
entity.setDeleteMark(1);
businessLineConfigService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
BusinessLineConfigEntity entity= businessLineConfigService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> businessLineConfigMap=JsonUtil.entityToMap(entity);
businessLineConfigMap.put("id", businessLineConfigMap.get("id"));
//副表数据
BusinessLineSonEntity businessLineSonEntity = businessLineConfigService.getBusinessLineSon(entity.getId());
if(ObjectUtil.isNotEmpty(businessLineSonEntity)){
Map<String, Object> businessLineSonMap=JsonUtil.entityToMap(businessLineSonEntity);
for(String key:businessLineSonMap.keySet()){
businessLineConfigMap.put("jnpf_jg_business_line_jnpf_"+key,businessLineSonMap.get(key));
}
}
BaseUserEntity baseUserEntity = businessLineConfigService.getBaseUser(entity.getId());
if(ObjectUtil.isNotEmpty(baseUserEntity)){
Map<String, Object> baseUserMap=JsonUtil.entityToMap(baseUserEntity);
for(String key:baseUserMap.keySet()){
businessLineConfigMap.put("jnpf_base_user_jnpf_"+key,baseUserMap.get(key));
}
}
//子表数据
businessLineConfigMap = generaterSwapUtil.swapDataDetail(businessLineConfigMap,BusinessLineConfigConstant.getFormData(),"520890418406097989",false);
return ActionResult.success(businessLineConfigMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
BusinessLineConfigEntity entity= businessLineConfigService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> businessLineConfigMap=JsonUtil.entityToMap(entity);
businessLineConfigMap.put("id", businessLineConfigMap.get("id"));
//副表数据
BusinessLineSonEntity businessLineSonEntity = businessLineConfigService.getBusinessLineSon(entity.getId());
if(ObjectUtil.isNotEmpty(businessLineSonEntity)){
Map<String, Object> businessLineSonMap=JsonUtil.entityToMap(businessLineSonEntity);
for(String key:businessLineSonMap.keySet()){
businessLineConfigMap.put("jnpf_jg_business_line_jnpf_"+key,businessLineSonMap.get(key));
}
}
BaseUserEntity baseUserEntity = businessLineConfigService.getBaseUser(entity.getId());
if(ObjectUtil.isNotEmpty(baseUserEntity)){
Map<String, Object> baseUserMap=JsonUtil.entityToMap(baseUserEntity);
for(String key:baseUserMap.keySet()){
businessLineConfigMap.put("jnpf_base_user_jnpf_"+key,baseUserMap.get(key));
}
}
//子表数据
businessLineConfigMap = generaterSwapUtil.swapDataForm(businessLineConfigMap,BusinessLineConfigConstant.getFormData(),BusinessLineConfigConstant.TABLEFIELDKEY,BusinessLineConfigConstant.TABLERENAMES);
return ActionResult.success(businessLineConfigMap);
}
}

@ -1,17 +1,26 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.vo.ListVO;
import jnpf.exception.DataException;
import jnpf.model.businesslineconfig.BusinessLineModel;
import jnpf.model.businesslineconfig.BusinessLineSonTree;
import jnpf.permission.entity.OrganizeEntity;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.model.organize.OrganizeModel;
import jnpf.permission.model.organize.OrganizeTreeVO;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.businessline.*;
import jnpf.util.treeutil.SumTree;
import jnpf.util.treeutil.newtreeutil.TreeDotUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -59,6 +68,32 @@ public class BusinessLineController {
private BusinessCargoService businessCargoService;
/**
* 线
*
* @return
*/
@Operation(summary = "获取业务线树形")
@GetMapping("/Tree")
public ActionResult<ListVO<BusinessLineSonTree>> tree() {
List<BusinessLineEntity> list = businessLineService.queryBusinessLineListInfo();
List<BusinessLineModel> models = JsonUtil.getJsonToList(list, BusinessLineModel.class);
List<SumTree<BusinessLineModel>> trees = TreeDotUtils.convertListToTreeDot(models);
List<BusinessLineSonTree> listVO = JsonUtil.getJsonToList(trees, BusinessLineSonTree.class);
//将子节点全部删除
Iterator<BusinessLineSonTree> iterator = listVO.iterator();
while (iterator.hasNext()) {
BusinessLineSonTree businessLineSonTree = iterator.next();
if (!"-1".equals(businessLineSonTree.getParentId())) {
iterator.remove();
}
}
ListVO vo = new ListVO();
vo.setList(listVO);
return ActionResult.success(vo);
}
/**
*
*
@ -236,11 +271,11 @@ public class BusinessLineController {
//副表数据
//子表数据
List<BusinessContactEntity> businessContactList = businessLineService.getBusinessContactList(entity.getId());
businessLineMap.put("businessContactList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContactList)));
businessLineMap.put("businesscontactList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContactList)));
List<BusinessAddressEntity> businessAddressList = businessLineService.getBusinessAddressList(entity.getId());
businessLineMap.put("businessAddressList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessAddressList)));
businessLineMap.put("businessaddressList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessAddressList)));
List<BusinessCargoEntity> businessCargoList = businessLineService.getBusinessCargoList(entity.getId());
businessLineMap.put("businessCargoList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessCargoList)));
businessLineMap.put("businesscargoList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessCargoList)));
businessLineMap = generaterSwapUtil.swapDataForm(businessLineMap,BusinessLineConstant.getFormData(),BusinessLineConstant.TABLEFIELDKEY,BusinessLineConstant.TABLERENAMES);
return ActionResult.success(businessLineMap);
}

@ -0,0 +1,141 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Data
@TableName("base_user")
public class BaseUserEntity {
@TableId(value ="F_ID" )
private String id;
@TableField("F_ACCOUNT")
private String account;
@TableField(value = "F_REAL_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String realName;
@TableField("F_QUICK_QUERY")
private String quickQuery;
@TableField("F_NICK_NAME")
private String nickName;
@TableField("F_HEAD_ICON")
private String headIcon;
@TableField("F_GENDER")
private Integer gender;
@TableField("F_BIRTHDAY")
private Date birthday;
@TableField(value = "F_MOBILE_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String mobilePhone;
@TableField("F_TELE_PHONE")
private String telePhone;
@TableField("F_LANDLINE")
private String landline;
@TableField("F_EMAIL")
private String email;
@TableField("F_NATION")
private String nation;
@TableField("F_NATIVE_PLACE")
private String nativePlace;
@TableField("F_ENTRY_DATE")
private Date entryDate;
@TableField("F_CERTIFICATES_TYPE")
private String certificatesType;
@TableField("F_CERTIFICATES_NUMBER")
private String certificatesNumber;
@TableField("F_EDUCATION")
private String education;
@TableField("F_URGENT_CONTACTS")
private String urgentContacts;
@TableField("F_URGENT_TELE_PHONE")
private String urgentTelePhone;
@TableField("F_POSTAL_ADDRESS")
private String postalAddress;
@TableField("F_SIGNATURE")
private String signature;
@TableField("F_PASSWORD")
private String password;
@TableField("F_SECRETKEY")
private String secretkey;
@TableField("F_FIRST_LOG_TIME")
private Date firstLogTime;
@TableField("F_FIRST_LOG_IP")
private String firstLogIp;
@TableField("F_PREV_LOG_TIME")
private Date prevLogTime;
@TableField("F_PREV_LOG_IP")
private String prevLogIp;
@TableField(value = "F_LAST_LOG_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date lastLogTime;
@TableField("F_LAST_LOG_IP")
private String lastLogIp;
@TableField("F_LOG_SUCCESS_COUNT")
private Integer logSuccessCount;
@TableField("F_LOG_ERROR_COUNT")
private Integer logErrorCount;
@TableField("F_CHANGE_PASSWORD_DATE")
private Date changePasswordDate;
@TableField("F_LANGUAGE")
private String language;
@TableField("F_THEME")
private String theme;
@TableField("F_COMMON_MENU")
private String commonMenu;
@TableField("F_IS_ADMINISTRATOR")
private Integer isAdministrator;
@TableField("F_PROPERTY_JSON")
private String propertyJson;
@TableField("F_MANAGER_ID")
private String managerId;
@TableField("F_ORGANIZE_ID")
private String organizeId;
@TableField("F_POSITION_ID")
private String positionId;
@TableField("F_ROLE_ID")
private String roleId;
@TableField("F_PORTAL_ID")
private String portalId;
@TableField("F_LOCK_MARK")
private Integer lockMark;
@TableField("F_UNLOCK_TIME")
private Date unlockTime;
@TableField("F_GROUP_ID")
private String groupId;
@TableField("F_SYSTEM_ID")
private String systemId;
@TableField("F_HANDOVER_MARK")
private Integer handoverMark;
@TableField("F_APP_SYSTEM_ID")
private String appSystemId;
@TableField("F_DING_JOB_NUMBER")
private String dingJobNumber;
@TableField("F_DESCRIPTION")
private String description;
@TableField(value = "F_ENABLED_MARK" , updateStrategy = FieldStrategy.IGNORED)
private Integer enabledMark;
@TableField("F_SORT_CODE")
private Long sortCode;
@TableField(value = "F_CREATOR_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField(value = "F_LAST_MODIFY_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_HANDOVER_USERID")
private String handoverUserid;
}

@ -0,0 +1,45 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Data
@TableName("jg_business_user_relational")
public class BusinessLineConfigEntity {
@TableId(value ="ID" )
private String id;
@TableField("BUSINESS_LINE_ID")
private String businessLineId;
@TableField("USER_ID")
private String userId;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_FLOW_TASK_ID")
private String flowTaskId;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -47,7 +47,7 @@ public class BusinessLineEntity {
@TableField("PHONE")
private Integer phone;
@TableField("DIFF_FLAG")
private String difflag;
private String diffFlag;
@TableField("FAX")
private String fax;
@TableField("URL")

@ -0,0 +1,105 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Data
@TableName("jg_business_line")
public class BusinessLineSonEntity {
@TableId(value ="ID" )
private String id;
@TableField("CODE")
private String code;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField("SIMPLE_NAME")
private String simpleName;
@TableField("LOGO")
private String logo;
@TableField("PARENT_ID")
private String parentId;
@TableField("TYPE")
private String type;
@TableField("STATUS")
private String status;
@TableField("RELATION_INSTITUTION_NUM")
private Integer relationInstitutionNum;
@TableField("EMPLOYEE_NUM")
private Integer employeeNum;
@TableField("INDUSTRY")
private String industry;
@TableField("CITY")
private String city;
@TableField("ESTABLISH_DATE")
private Date establishDate;
@TableField("BELONG_USER_ID")
private String belongUserId;
@TableField("BRAND_NAME")
private String brandName;
@TableField("PHONE")
private Integer phone;
@TableField("DIFF_FLAG")
private String difflag;
@TableField("FAX")
private String fax;
@TableField("URL")
private String url;
@TableField("DESCRIPTION")
private String description;
@TableField("BUSINESS_TYPE")
private String businessType;
@TableField("BUSINESS_HOURS")
private String businessHours;
@TableField("BUSINESS_START")
private Date businessStart;
@TableField("BUSINESS_END")
private Date businessEnd;
@TableField("ALLOW_UNLOADING_START")
private Date allowUnloadingStart;
@TableField("ALLOW_UNLOADING_END")
private Date allowUnloadingEnd;
@TableField("UNLOADING_DURATION")
private String unloadingDuration;
@TableField("UNLOADING_EFFICIENCY")
private String unloadingEfficiency;
@TableField("ALLOW_LOADING_START")
private Date allowLoadingStart;
@TableField("ALLOW_LOADING_END")
private Date allowLoadingEnd;
@TableField("LOADING_DURATION")
private String loadingDuration;
@TableField("LOADING_EFFCIENCY")
private String loadingEffciency;
@TableField("EMAIL")
private String email;
@TableField("ERP_TYPE")
private String erpType;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -89,4 +89,11 @@ public class BusinessLineForm {
/** 卸货效率 **/
@JsonProperty("unloadingEfficiency")
private String unloadingEfficiency;
/** 所属分类 **/
@JsonProperty("industry")
private String industry;
/** 业务线/仓库区分 **/
@JsonProperty("diffFlag")
private String diffFlag;
}

@ -0,0 +1,43 @@
package jnpf.model.businesslineconfig;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* businessLineConfig
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
@Data
public class BaseUserModel {
/** 姓名 **/
@JSONField(name = "realName")
private String realName;
/** 帐号状态 **/
@JSONField(name = "enabledMark")
private Object enabledMark;
/** 手机 **/
@JSONField(name = "mobilePhone")
private String mobilePhone;
/** 最后登录 **/
@JSONField(name = "lastLogTime")
private Long lastLogTime;
/** 创建时间 **/
@JSONField(name = "creatorTime")
private Long creatorTime;
/** 修改时间 **/
@JSONField(name = "lastModifyTime")
private Long lastModifyTime;
}

@ -0,0 +1,47 @@
package jnpf.model.businesslineconfig;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* businessLineConfig
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Data
public class BusinessLineConfigForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 姓名 **/
@JsonProperty("jnpf_base_user_jnpf_realName")
private String jnpf_base_user_jnpf_realName;
/** 帐号状态 **/
@JsonProperty("jnpf_base_user_jnpf_enabledMark")
private Object jnpf_base_user_jnpf_enabledMark;
/** 手机 **/
@JsonProperty("jnpf_base_user_jnpf_mobilePhone")
private String jnpf_base_user_jnpf_mobilePhone;
/** 最后登录 **/
@JsonProperty("jnpf_base_user_jnpf_lastLogTime")
private String jnpf_base_user_jnpf_lastLogTime;
/** 创建时间 **/
@JsonProperty("jnpf_base_user_jnpf_creatorTime")
private String jnpf_base_user_jnpf_creatorTime;
/** 修改时间 **/
@JsonProperty("jnpf_base_user_jnpf_lastModifyTime")
private String jnpf_base_user_jnpf_lastModifyTime;
/** 业务线名称 **/
@JsonProperty("jnpf_jg_business_line_jnpf_name")
private String jnpf_jg_business_line_jnpf_name;
}

@ -0,0 +1,39 @@
package jnpf.model.businesslineconfig;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* businessLineConfig
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-01-27
*/
@Data
public class BusinessLineConfigPagination extends Pagination {
/** 查询key */
private String[] selectKey;
/** json */
private String json;
/** 数据类型 0-当前页1-全部数据 */
private String dataType;
/** 高级查询 */
private String superQueryJson;
/** 功能id */
private String moduleId;
/** 菜单id */
private String menuId;
/** 姓名 */
@JsonProperty("jnpf_base_user_jnpf_realName")
private Object jnpf_base_user_jnpf_realName;
/** 最后登录 */
@JsonProperty("jnpf_base_user_jnpf_lastLogTime")
private Object jnpf_base_user_jnpf_lastLogTime;
/** tree */
@JsonProperty("jnpf_jg_business_line_jnpf_name")
private Object jnpf_jg_business_line_jnpf_name;
}

@ -0,0 +1,20 @@
package jnpf.model.businesslineconfig;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import jnpf.util.treeutil.SumTree;
import lombok.Data;
import java.util.List;
@Data
public class BusinessLineModel extends SumTree {
private String name;
private String code;
private Long creatorTime;
@Schema(description = "组织id树")
private List<String> businessLineIds;
private String parentId;
}

@ -0,0 +1,24 @@
package jnpf.model.businesslineconfig;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* businessLineConfig
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-01-27
*/
@Data
public class BusinessLineSonModel {
/** 业务线名称 **/
@JSONField(name = "name")
private String name;
}

@ -0,0 +1,28 @@
package jnpf.model.businesslineconfig;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
/**
*
* @author JNPF
* @version V3.1.0
* @copyright
* @date 2021/3/12 15:31
*/
@Data
public class BusinessLineSonTree {
@Schema(description = "主键")
private String id;
@Schema(description = "父主键")
private String parentId;
@Schema(description = "名称")
private String name;
@Schema(description = "是否有下级菜单")
private Boolean hasChildren;
@Schema(description = "下级菜单列表")
private List<BusinessLineSonTree> children;
}

@ -9,6 +9,15 @@ export const getOrganizeList = (data) => {
})
}
// 获取组织/公司列表
export const getEnterpriseList = (data) => {
return request({
url: '/api/permission/Organize/Enterprise',
method: 'GET',
data
})
}
// 获取组织/公司下拉框列表
export const getOrganizeSelector = (id) => {
return request({

@ -0,0 +1,228 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item :label="$t('common.keyword')">
<el-input v-model="listQuery.keyword" :placeholder="$t('common.enterKeyword')"
clearable @keyup.enter.native="search()" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<el-dropdown>
<!-- <el-button type="primary" icon="el-icon-plus">
新建<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="addOrUpdateHandle('','company')">新建公司
</el-dropdown-item>
<el-dropdown-item @click.native="addOrUpdateHandle()">新建部门</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<div class="JNPF-common-head-right">
<el-tooltip effect="dark" content="展开" placement="top">
<el-link v-show="!expands" type="text"
icon="icon-ym icon-ym-btn-expand JNPF-common-head-icon" :underline="false"
@click="toggleExpand()" />
</el-tooltip>
<el-tooltip effect="dark" content="折叠" placement="top">
<el-link v-show="expands" type="text"
icon="icon-ym icon-ym-btn-collapse JNPF-common-head-icon" :underline="false"
@click="toggleExpand()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="treeList" row-key="id" v-if="refreshTable"
:default-expand-all="expands" :tree-props="{children: 'children', hasChildren: ''}">
<el-table-column prop="fullName" label="名称">
<template slot-scope="scope">
<i :class="'table-icon icon-my '+scope.row.icon"></i>{{scope.row.fullName}}
</template>
</el-table-column>
<el-table-column prop="enCode" label="编码" />
<el-table-column prop="index" label="层级" width="100" align="center" />
<el-table-column prop="type" label="类型" width="100" align="center">
<template slot-scope="scope">
{{scope.row.type==='company'?'公司':'部门'}}
</template>
</el-table-column>
<el-table-column prop="creatorTime" :formatter="jnpf.tableDateFormat" label="创建时间"
width="120" />
<el-table-column prop="sortCode" label="排序" width="70" align="center" />
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<tableOpts @edit="addOrUpdateHandle(scope.row.id,scope.row.type,scope.row.parentId)"
@del="handleDel(scope.row.id)">
<el-dropdown>
<span class="el-dropdown-link">
<el-button type="text" size="mini">{{$t('common.moreBtn')}}<i
class="el-icon-arrow-down el-icon--right"></i>
</el-button>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="checkMembers(scope.row.id,scope.row.fullName)">
查看成员</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</tableOpts>
</template>
</el-table-column>
</JNPF-table>
</div>
</div>
<Form v-show="formVisible" ref="Form" @close="closeForm" />
<DepForm v-if="depFormVisible" ref="depForm" @close="closeDepForm" />
<CheckUser v-if="checkUserFormVisible" ref="checkUserForm"
@close="checkUserFormVisible=false" />
</div>
</template>
<script>
import { getOrganizeList, delOrganize, getEnterpriseList } from '@/api/permission/organize'
import Form from './Form'
import DepForm from './depForm'
import CheckUser from './checkUser.vue'
export default {
name: 'permission-organize',
components: { Form, DepForm, CheckUser },
data() {
return {
listQuery: {
keyword: ''
},
treeList: [],
expands: true,
refreshTable: true,
btnLoading: false,
listLoading: true,
formVisible: false,
depFormVisible: false,
checkUserFormVisible: false
}
},
created() {
this.initData()
},
methods: {
initData() {
this.loading = true
getEnterpriseList(this.listQuery).then(res => {
this.treeList = res.data.list
if (this.treeList.length > 0) this.setTableIndex(this.treeList);
this.listLoading = false
this.btnLoading = false
}).catch(() => {
this.listLoading = false
this.btnLoading = false
})
},
search() {
this.initData()
},
// index
setTableIndex(arr, index) {
arr.forEach((item) => {
item.index = 1;
if (index) item.index = index + 1;
if (item.children) this.setTableIndex(item.children, item.index);
});
},
reset() {
this.listQuery.keyword = ''
this.initData()
},
addOrUpdateHandle(id, type, parentId) {
if (type === 'company') {
this.addOrUpdateOrganize(id, parentId)
} else {
this.addOrUpdateDep(id)
}
},
addOrUpdateOrganize(id, parentId) {
this.formVisible = true
this.$nextTick(() => {
this.$refs.Form.init(id, parentId)
})
},
addOrUpdateDep(id) {
this.depFormVisible = true
this.$nextTick(() => {
this.$refs.depForm.init(id)
})
},
closeForm(isRefresh) {
this.formVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
closeDepForm(isRefresh) {
this.depFormVisible = false
if (isRefresh) {
this.keyword = ''
this.initData()
}
},
checkMembers(id, name) {
this.checkUserFormVisible = true
this.$nextTick(() => {
this.$refs.checkUserForm.init(id, name)
})
},
checkUser() {
},
toggleExpand() {
this.refreshTable = false;
this.expands = !this.expands;
this.$nextTick(() => {
this.refreshTable = true;
});
},
handleDel(id) {
this.$confirm(this.$t('common.delTip'), this.$t('common.tipTitle'), {
type: 'warning'
}).then(() => {
delOrganize(id).then(res => {
this.$message({
type: 'success',
message: res.msg,
duration: 1500,
onClose: () => {
this.$store.commit('generator/SET_COMPANY_TREE', [])
this.$store.commit('generator/SET_DEP_TREE', [])
this.initData()
}
})
})
}).catch(() => { })
}
}
}
</script>
<style lang="scss" scoped>
.table-icon {
vertical-align: bottom;
font-size: 16px;
margin-right: 6px;
line-height: 23px;
}
</style>

@ -239,6 +239,7 @@ export default {
this.filterText = ''
this.treeLoading = true
getDepartmentSelectorByAuth().then(res => {
debugger
this.treeData = res.data.list
this.treeLoading = false
if (isInit) this.initData()

@ -1,206 +0,0 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
content="详情"/>
<div class="options">
<el-button @click="goBack"></el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="formRef" :model="dataForm" size="default" label-width="100px" label-position="left" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<JnpfGroupTitle
contentPosition="left" :closable= "false" content ="基础信息" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="业务线编号"
prop="code" >
<p>{{dataForm.code}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="业务线名称"
prop="name" >
<p>{{dataForm.name}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="业务线简称"
prop="simpleName" >
<p>{{dataForm.simpleName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="类型"
prop="type" >
<p>{{dataForm.type}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="所属分类"
prop="industry" >
<p>{{dataForm.industry}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="所在城市"
prop="city" >
<p>{{dataForm.city}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="成立时间"
prop="establishDate" >
<p>{{dataForm.establishDate}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="描述"
prop="description" >
<p>{{dataForm.description}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<JnpfGroupTitle
contentPosition="left" :closable= "false" content ="联系人信息" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<el-table :data="dataForm.tableField133" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="contactType" label="类型" >
<template slot-scope="scope">
<p>{{scope.row.contactType}}</p>
</template>
</el-table-column>
<el-table-column prop="name" label="姓名" >
<template slot-scope="scope">
<p>{{scope.row.name}}</p>
</template>
</el-table-column>
<el-table-column prop="phone" label="手机号" >
<template slot-scope="scope">
<p>{{scope.row.phone}}</p>
</template>
</el-table-column>
<el-table-column prop="landline" label="座机" >
<template slot-scope="scope">
<p>{{scope.row.landline}}</p>
</template>
</el-table-column>
<el-table-column prop="email" label="邮箱" >
<template slot-scope="scope">
<p>{{scope.row.email}}</p>
</template>
</el-table-column>
<el-table-column prop="fax" label="传真" >
<template slot-scope="scope">
<p>{{scope.row.fax}}</p>
</template>
</el-table-column>
<el-table-column prop="lastModifyTime" label="更新时间" >
<template slot-scope="scope">
<p>{{scope.row.lastModifyTime}}</p>
</template>
</el-table-column>
</el-table>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
code : '',
name : '',
simpleName : '',
type : "",
industry : "",
city : [],
establishDate : '',
description : '',
businesscontactList:[],
},
typeProps:{"label":"fullName","value":"id" },
industryProps:{"label":"fullName","value":"id" },
contactTypeProps:{"label":"fullName","value":"id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
goBack() {
this.$emit('refresh')
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/BusinessLine/detail/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
}
})
},
},
}
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,368 @@
<template>
<div :style="{margin: '0 auto',width:'100%'}">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" :disabled="setting.readonly" >
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_realName')" >
<jnpf-form-tip-item
label="姓名" v-if="judgeShow('jnpf_base_user_jnpf_realName')" prop="jnpf_base_user_jnpf_realName" >
<JnpfInput v-model="dataForm.jnpf_base_user_jnpf_realName" @change="changeData('jnpf_base_user_jnpf_realName',-1)"
placeholder="请输入" :disabled="judgeWrite('jnpf_base_user_jnpf_realName')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_enabledMark')" >
<jnpf-form-tip-item
label="帐号状态" v-if="judgeShow('jnpf_base_user_jnpf_enabledMark')" prop="jnpf_base_user_jnpf_enabledMark" >
<JnpfSelect v-model="dataForm.jnpf_base_user_jnpf_enabledMark" @change="changeData('jnpf_base_user_jnpf_enabledMark',-1)"
placeholder="请选择" :disabled="judgeWrite('jnpf_base_user_jnpf_enabledMark')" clearable :style='{"width":"100%"}' :options="jnpf_base_user_jnpf_enabledMarkOptions" :props="jnpf_base_user_jnpf_enabledMarkProps" >
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_mobilePhone')" >
<jnpf-form-tip-item
label="手机" v-if="judgeShow('jnpf_base_user_jnpf_mobilePhone')" prop="jnpf_base_user_jnpf_mobilePhone" >
<JnpfInput v-model="dataForm.jnpf_base_user_jnpf_mobilePhone" @change="changeData('jnpf_base_user_jnpf_mobilePhone',-1)"
placeholder="请输入" :disabled="judgeWrite('jnpf_base_user_jnpf_mobilePhone')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_lastLogTime')" >
<jnpf-form-tip-item
label="最后登录" v-if="judgeShow('jnpf_base_user_jnpf_lastLogTime')" prop="jnpf_base_user_jnpf_lastLogTime" >
<JnpfDatePicker v-model="dataForm.jnpf_base_user_jnpf_lastLogTime" @change="changeData('jnpf_base_user_jnpf_lastLogTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择" :disabled="judgeWrite('jnpf_base_user_jnpf_lastLogTime')" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" >
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_creatorTime')" >
<jnpf-form-tip-item
label="创建时间" v-if="judgeShow('jnpf_base_user_jnpf_creatorTime')" prop="jnpf_base_user_jnpf_creatorTime" >
<JnpfDatePicker v-model="dataForm.jnpf_base_user_jnpf_creatorTime" @change="changeData('jnpf_base_user_jnpf_creatorTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择" :disabled="judgeWrite('jnpf_base_user_jnpf_creatorTime')" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" >
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_base_user_jnpf_lastModifyTime')" >
<jnpf-form-tip-item
label="修改时间" v-if="judgeShow('jnpf_base_user_jnpf_lastModifyTime')" prop="jnpf_base_user_jnpf_lastModifyTime" >
<JnpfDatePicker v-model="dataForm.jnpf_base_user_jnpf_lastModifyTime" @change="changeData('jnpf_base_user_jnpf_lastModifyTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择" :disabled="judgeWrite('jnpf_base_user_jnpf_lastModifyTime')" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" >
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('jnpf_jg_business_line_jnpf_name')" >
<jnpf-form-tip-item
label="业务线名称" v-if="judgeShow('jnpf_jg_business_line_jnpf_name')" prop="jnpf_jg_business_line_jnpf_name" >
<JnpfInput v-model="dataForm.jnpf_jg_business_line_jnpf_name" @change="changeData('jnpf_jg_business_line_jnpf_name',-1)"
placeholder="请输入" :disabled="judgeWrite('jnpf_jg_business_line_jnpf_name')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import {getFormById} from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
mixins: [comMixin],
components: { },
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting:{},
eventType: '',
userBoxVisible:false,
selectDialogVisible: false,
currTableConf:{},
dataValueAll:{},
addTableConf:{
},
//
ableAll:{
},
tableRows:{
},
Vmodel:"",
currVmodel:"",
dataForm: {
jg_business_line:
{
name:'',
},
base_user:
{
realName:'',
enabledMark:'',
mobilePhone:'',
lastLogTime:'',
creatorTime:'',
lastModifyTime:'',
},
jnpf_base_user_jnpf_realName : '',
jnpf_base_user_jnpf_enabledMark : "",
jnpf_base_user_jnpf_mobilePhone : '',
jnpf_base_user_jnpf_lastLogTime : '',
jnpf_base_user_jnpf_creatorTime : '',
jnpf_base_user_jnpf_lastModifyTime : '',
jnpf_jg_business_line_jnpf_name : '',
version: 0,
},
tableRequiredData: {},
dataRule:
{
},
jnpf_base_user_jnpf_enabledMarkOptions:[{"fullName":"选项一","id":"1"},{"fullName":"选项二","id":"2"}],
jnpf_base_user_jnpf_enabledMarkProps:{"label":"fullName","value":"id" },
childIndex:-1,
isEdit:false,
interfaceRes: {
jnpf_base_user_jnpf_realName:[] ,
jnpf_base_user_jnpf_enabledMark:[] ,
jnpf_base_user_jnpf_mobilePhone:[] ,
jnpf_base_user_jnpf_lastLogTime:[] ,
jnpf_base_user_jnpf_creatorTime:[] ,
jnpf_base_user_jnpf_lastModifyTime:[] ,
jnpf_jg_business_line_jnpf_name:[] ,
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if(this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if(this[options]){
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model,index,defaultValue) {
if(!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll(){
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit(){
const _data =this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("520890418406097989").then(res => {
this.dataForm.flowId = res.data&&res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
return isOk
},
clearData(){
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
},
openSelectDialog(key) {
this.currTableConf=this.addTableConf[key]
this.currVmodel=key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if(this['get'+this.currVmodel]){
this['get'+this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList(){
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
this.childIndex=-1
},
},
}
</script>

@ -0,0 +1,628 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>左侧标题</h2>
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="toggleTreeExpand(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click.native="toggleTreeExpand(false)">折叠全部</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="JNPF-common-tree-search-box">
<el-input placeholder="输入关键字" v-model="keyword" suffix-icon="el-icon-search" clearable />
</div>
<el-tree :data="treeData" class="JNPF-common-el-tree" highlight-current ref="treeBox"
:expand-on-click-node="false" @node-click="handleNodeClick" node-key="id" :props="treeProps"
:default-expand-all="expandsTree" :filter-node-method="filterNode" :lazy="false"
v-if="refreshTree">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="姓名">
<el-input v-model="query.jnpf_base_user_jnpf_realName" placeholder="请输入" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="最后登录">
<JnpfDateRangePicker v-model="query.jnpf_base_user_jnpf_lastLogTime"
format="yyyy-MM-dd" startPlaceholder="开始日期" endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" v-has="'btn_add'"
@click="addOrUpdateHandle()">新增
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()"
v-has="'btn_download'">导出
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()"
v-has="'btn_batchRemove'">批量删除
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="jnpf_base_user_jnpf_realName" label="姓名" align="left">
</el-table-column>
<el-table-column label="帐号状态" prop="jnpf_base_user_jnpf_enabledMark" algin="left">
<template slot-scope="scope">
{{ scope.row.jnpf_base_user_jnpf_enabledMark}}
</template>
</el-table-column>
<el-table-column prop="jnpf_base_user_jnpf_mobilePhone" label="手机" align="left">
</el-table-column>
<el-table-column prop="jnpf_base_user_jnpf_lastLogTime" label="最后登录" align="left">
</el-table-column>
<el-table-column prop="jnpf_base_user_jnpf_creatorTime" label="创建时间" align="left">
</el-table-column>
<el-table-column prop="jnpf_base_user_jnpf_lastModifyTime" label="修改时间" align="left">
</el-table-column>
<el-table-column prop="flowState" label="状态" width="100">
<template slot-scope="scope" v-if="!scope.row.top">
<el-tag v-if="scope.row.flowState==1"></el-tag>
<el-tag type="success" v-else-if="scope.row.flowState==2">审核通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.flowState==3">审核驳回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==4">流程撤回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState==5">审核终止</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" :disabled="[1,2,4,5].indexOf(scope.row.flowState)>-1"
@click="updateHandle(scope.row)" v-has="'btn_edit'">编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn"
:disabled="[1,2,3,5].indexOf(scope.row.flowState)>-1" v-has="'btn_remove'"
@click="handleDel(scope.row.id)">删除
</el-button>
<el-button size="mini" type="text" :disabled="!scope.row.flowState"
@click="updateHandle(scope.row,scope.row.flowState)">详情</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
<FlowBox v-if="flowVisible" ref="FlowBox" @close="colseFlow" />
<el-dialog title="请选择流程" :close-on-click-modal="false" append-to-body
:visible.sync="flowListVisible" class="JNPF-dialog template-dialog JNPF-dialog_center"
lock-scroll width="400px">
<el-scrollbar class="template-list">
<div class="template-item" v-for="item in flowList" :key="item.id"
@click="selectFlow(item)">{{item.fullName}}
</div>
</el-scrollbar>
</el-dialog>
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false" />
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail"
@close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson"
@superQuery="superQuery" />
</div>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getFormById } from '@/api/workFlow/FormDesign'
import { getFlowList } from '@/api/workFlow/FlowEngine'
import FlowBox from '@/views/workFlow/components/FlowBox'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
export default {
components: {
FlowBox,
ExportBox, ToFormDetail, SuperQuery
},
data() {
return {
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
jnpf_base_user_jnpf_realName: undefined,
jnpf_base_user_jnpf_lastLogTime: undefined,
},
treeProps: {
children: 'children',
label: 'name',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
multipleSelection: [], total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
treeData: [],
treeActiveId: '',
jnpf_base_user_jnpf_enabledMarkOptions: [{ "fullName": "选项一", "id": "1" }, { "fullName": "选项二", "id": "2" }],
jnpf_base_user_jnpf_enabledMarkProps: { "label": "fullName", "value": "id" },
interfaceRes: {
},
}
},
watch: {
keyword(val) {
this.$refs.treeBox.filter(val)
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
getFormById("520890418406097989").then(res1 => {
let flowId = res1.data && res1.data.id
getFlowList(flowId, '1').then(res2 => {
this.flowList = res2.data
this.getColumnList(),
this.getTreeView();
this.queryData = JSON.parse(JSON.stringify(this.query))
}).catch((e) => {
this.$message({ type: 'error', message: e.message });
this.$router.push('/404');
})
})
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config = {
treeInterfaceId: "",
treeTemplateJson: []
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({ column }) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
goDetail(id) {
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({ column, prop, order }) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
getTreeView() {
getDataInterfaceRes('519521191191380165').then(res => {
let data = res.data
this.treeData = data
this.initSearchDataAndListData()
})
},
getNodePath(node) {
let fullPath = []
const loop = (node) => {
if (node.level) fullPath.unshift(node.data)
if (node.parent) loop(node.parent)
}
loop(node)
return fullPath
},
handleNodeClick(data, node) {
this.treeActiveId = data.id
for (let key in this.query) {
this.query[key] = undefined
}
this.query.jnpf_jg_business_line_jnpf_name = data.id
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
}
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {
},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: '520890418406097989',
type: 2,
};
request({
url: `/api/scm/BusinessLineConfig/getList`,
method: 'post',
data: _query
}).then(res => {
var _list = res.data.list;
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/BusinessLineConfig/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
});
},
handelUpload() {
this.uploadBoxVisible = true
this.$nextTick(() => {
this.$refs.UploadBox.init("", "scm/BusinessLineConfig")
})
},
handleSelectionChange(val) {
const res = val.map(item => item.id)
this.multipleSelection = res
},
handleBatchRemoveDel() {
if (!this.multipleSelection.length) {
this.$message({
type: 'error',
message: '请选择一条数据',
duration: 1500,
})
return
}
const ids = this.multipleSelection
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/BusinessLineConfig/batchRemove`,
data: ids,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
})
},
openSuperQuery() {
this.superQueryVisible = true
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
},
addOrUpdateHandle(row, flowState) {
if (!row) {
this.addHandle();
} else {
this.updateHandle(row, flowState)
}
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = { ...data, ...this.listQuery, ...this.query, menuId: this.menuId }
request({
url: `/api/scm/BusinessLineConfig/Actions/Export`,
method: 'post',
data: query
}).then(res => {
if (!res.data.url) return
this.jnpf.downloadFile(res.data.url)
this.$refs.ExportBox.visible = false
this.exportBoxVisible = false
})
},
search() {
this.listQuery.currentPage = 1
this.listQuery.pageSize = 20
this.listQuery.sort = "desc"
this.listQuery.sidx = ""
this.initData()
},
//
updateHandle(row, flowState) {
let data = {
id: row.id,
flowId: row.flowId || this.flowList[0].id,
opType: flowState ? 0 : '-1',
status: flowState
}
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
toApprovalDetail(row) {
let data = {
id: row.id,
flowId: row.flowId,
opType: 0,
status: row.currentState
}
this.formVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
addHandle() {
if (!this.flowList.length) {
this.$message({ type: 'error', message: '流程不存在' });
} else if (this.flowList.length === 1) {
this.selectFlow(this.flowList[0])
} else {
this.flowListVisible = true
}
},
//
selectFlow(item) {
let data = {
id: '',
formType: 1,
flowId: item.id,
opType: '-1'
}
this.flowListVisible = false
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
refresh(isrRefresh) {
this.formVisible = false
if (isrRefresh) this.reset()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
colseFlow(isrRefresh) {
this.flowVisible = false
if (isrRefresh) this.reset()
},
}
}
</script>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save