bom列表页和班组修改

jg-waiwang-pro
XI_TENG\xixi_ 9 months ago
parent fd56d507a8
commit c6282a8fea

@ -24,7 +24,8 @@
t4.code AS productCode,
t4.inventory_unit_id AS inventoryUnitId,
t4.spec AS productSpec,
t5.category_name AS categoryName
t5.category_name AS categoryName,
t5.product_type_id AS productTypeId
from jg_bom t1
LEFT JOIN jg_bom_item t2 ON t1.id=t2.bom_id AND t2.f_delete_mark is NULL
LEFT JOIN jg_bom_item_value t3 ON t1.id=t3.bom_id AND t3.f_delete_mark is NULL

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.BusinessContact1Mapper">
</mapper>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.BusinessLine1Mapper">
</mapper>

@ -3,5 +3,10 @@
<mapper namespace="jnpf.mapper.ClassTeamMapper">
<select id="queryClassTeamUse" resultType="Integer">
select count(0) from jg_class_team_use a
where a.team_id = #{id}
</select>
</mapper>

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BusinessContact1Entity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
public interface BusinessContact1Mapper extends BaseMapper<BusinessContact1Entity> {
}

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.BusinessLine1Entity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
public interface BusinessLine1Mapper extends BaseMapper<BusinessLine1Entity> {
}

@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ClassTeamMapper extends BaseMapper<ClassTeamEntity> {
Integer queryClassTeamUse(String id);
}

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.businessline1.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
public interface BusinessContact1Service extends IService<BusinessContact1Entity> {
QueryWrapper<BusinessContact1Entity> getChild(BusinessLine1Pagination pagination,QueryWrapper<BusinessContact1Entity> businessContact1QueryWrapper);
}

@ -0,0 +1,39 @@
package jnpf.service;
import jnpf.model.businessline1.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
public interface BusinessLine1Service extends IService<BusinessLine1Entity> {
List<BusinessLine1Entity> getList(BusinessLine1Pagination businessLine1Pagination);
List<BusinessLine1Entity> getTypeList(BusinessLine1Pagination businessLine1Pagination,String dataType);
BusinessLine1Entity getInfo(String id);
void delete(BusinessLine1Entity entity);
void create(BusinessLine1Entity entity);
boolean update(String id, BusinessLine1Entity entity);
//子表方法
List<BusinessContact1Entity> getBusinessContact1List(String id,BusinessLine1Pagination businessLine1Pagination);
List<BusinessContact1Entity> getBusinessContact1List(String id);
//副表数据方法
String checkForm(BusinessLine1Form form,int i);
void saveOrUpdate(BusinessLine1Form businessLine1Form,String id, boolean isSave) throws Exception;
}

@ -40,4 +40,8 @@ public interface ClassTeamService extends IService<ClassTeamEntity> {
void saveOrUpdate(ClassTeamForm classTeamForm,String id, boolean isSave) throws Exception;
//查询班组的员工数量
int queryClassTeamUseInfo(String id);
}

@ -0,0 +1,61 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BusinessContact1Mapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.businessline1.*;
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;
/**
*
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
@Service
public class BusinessContact1ServiceImpl extends ServiceImpl<BusinessContact1Mapper, BusinessContact1Entity> implements BusinessContact1Service{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<BusinessContact1Entity> getChild(BusinessLine1Pagination pagination, QueryWrapper<BusinessContact1Entity> businessContact1QueryWrapper){
boolean pcPermission = true;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?BusinessLine1Constant.getColumnData():BusinessLine1Constant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
if(!isPc){
}
return businessContact1QueryWrapper;
}
}

@ -0,0 +1,461 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.BusinessLine1Mapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.businessline1.*;
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;
/**
*
* businessLine1
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
@Service
public class BusinessLine1ServiceImpl extends ServiceImpl<BusinessLine1Mapper, BusinessLine1Entity> implements BusinessLine1Service{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BusinessContact1Service businessContact1Service;
@Override
public List<BusinessLine1Entity> getList(BusinessLine1Pagination businessLine1Pagination){
return getTypeList(businessLine1Pagination,businessLine1Pagination.getDataType());
}
/** 列表查询 */
@Override
public List<BusinessLine1Entity> getTypeList(BusinessLine1Pagination businessLine1Pagination,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 ? BusinessLine1Constant.getAppColumnData() : BusinessLine1Constant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int businessLine1Num =0;
QueryWrapper<BusinessLine1Entity> businessLine1QueryWrapper=new QueryWrapper<>();
int businessContact1Num =0;
QueryWrapper<BusinessContact1Entity> businessContact1QueryWrapper=new QueryWrapper<>();
long businessContact1count = businessContact1Service.count();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(businessLine1Pagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = businessLine1Pagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<BusinessLine1Entity> businessLine1SuperWrapper = new QueryWrapper<>();
businessLine1SuperWrapper = generaterSwapUtil.getCondition(new QueryModel(businessLine1SuperWrapper,BusinessLine1Entity.class,queryJson,"0"));
int businessLine1Num1 = businessLine1SuperWrapper.getExpression().getNormal().size();
if (businessLine1Num1>0){
List<String> businessLine1List =this.list(businessLine1SuperWrapper).stream().map(BusinessLine1Entity::getId).collect(Collectors.toList());
allSuperList.addAll(businessLine1List);
intersectionSuperList.add(businessLine1List);
superNum++;
}
String businessContact1Table = "jg_business_contact";
boolean businessContact1HasSql = queryJson.contains(businessContact1Table);
List<String> businessContact1List = generaterSwapUtil.selectIdsByChildCondition(BusinessLine1Constant.getTableList(), businessContact1Table , queryJson, null);
if (businessContact1HasSql){
allSuperList.addAll(businessContact1List);
intersectionSuperList.add(businessContact1List);
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<BusinessLine1Entity> businessLine1SuperWrapper = new QueryWrapper<>();
businessLine1SuperWrapper = generaterSwapUtil.getCondition(new QueryModel(businessLine1SuperWrapper,BusinessLine1Entity.class,ruleJson,"0"));
int businessLine1Num1 = businessLine1SuperWrapper.getExpression().getNormal().size();
if (businessLine1Num1>0){
List<String> businessLine1List =this.list(businessLine1SuperWrapper).stream().map(BusinessLine1Entity::getId).collect(Collectors.toList());
allRuleList.addAll(businessLine1List);
intersectionRuleList.add(businessLine1List);
ruleNum++;
}
String businessContact1Table = "jg_business_contact";
boolean businessContact1HasSql = ruleJson.contains(businessContact1Table);
List<String> businessContact1List = generaterSwapUtil.selectIdsByChildCondition(BusinessLine1Constant.getTableList(), businessContact1Table , ruleJson, null);
if (businessContact1HasSql){
allRuleList.addAll(businessContact1List);
intersectionRuleList.add(businessContact1List);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object businessLine1Obj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLine1QueryWrapper,BusinessLine1Entity.class,businessLine1Pagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLine1Obj)){
return new ArrayList<>();
} else {
businessLine1QueryWrapper = (QueryWrapper<BusinessLine1Entity>)businessLine1Obj;
if( businessLine1QueryWrapper.getExpression().getNormal().size()>0){
businessLine1Num++;
}
}
Object businessContact1Obj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessContact1QueryWrapper,BusinessContact1Entity.class,businessLine1Pagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessContact1Obj)){
return new ArrayList<>();
} else {
businessContact1QueryWrapper = (QueryWrapper<BusinessContact1Entity>)businessContact1Obj;
if( businessContact1QueryWrapper.getExpression().getNormal().size()>0){
businessContact1Num++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object businessLine1Obj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessLine1QueryWrapper,BusinessLine1Entity.class,businessLine1Pagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessLine1Obj)){
return new ArrayList<>();
} else {
businessLine1QueryWrapper = (QueryWrapper<BusinessLine1Entity>)businessLine1Obj;
if( businessLine1QueryWrapper.getExpression().getNormal().size()>0){
businessLine1Num++;
}
}
Object businessContact1Obj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(businessContact1QueryWrapper,BusinessContact1Entity.class,businessLine1Pagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(businessContact1Obj)){
return new ArrayList<>();
} else {
businessContact1QueryWrapper = (QueryWrapper<BusinessContact1Entity>)businessContact1Obj;
if( businessContact1QueryWrapper.getExpression().getNormal().size()>0){
businessContact1Num++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(businessLine1Pagination.getCode())){
businessLine1Num++;
String value = businessLine1Pagination.getCode() instanceof List ?
JsonUtil.getObjectToString(businessLine1Pagination.getCode()) :
String.valueOf(businessLine1Pagination.getCode());
businessLine1QueryWrapper.lambda().like(BusinessLine1Entity::getCode,value);
}
if(ObjectUtil.isNotEmpty(businessLine1Pagination.getParentId())){
businessLine1Num++;
String value = businessLine1Pagination.getParentId() instanceof List ?
JsonUtil.getObjectToString(businessLine1Pagination.getParentId()) :
String.valueOf(businessLine1Pagination.getParentId());
businessLine1QueryWrapper.lambda().like(BusinessLine1Entity::getParentId,value);
}
if(ObjectUtil.isNotEmpty(businessLine1Pagination.getType())){
businessLine1Num++;
List<String> idList = new ArrayList<>();
try {
String[][] type = JsonUtil.getJsonToBean(businessLine1Pagination.getType(),String[][].class);
for(int i=0;i<type.length;i++){
if(type[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(type[i])));
}
}
}catch (Exception e1){
try {
List<String> type = JsonUtil.getJsonToList(businessLine1Pagination.getType(),String.class);
if(type.size()>0){
idList.addAll(type);
}
}catch (Exception e2){
idList.add(String.valueOf(businessLine1Pagination.getType()));
}
}
businessLine1QueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(BusinessLine1Entity::getType, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(businessLine1Pagination.getName())){
businessLine1Num++;
String value = businessLine1Pagination.getName() instanceof List ?
JsonUtil.getObjectToString(businessLine1Pagination.getName()) :
String.valueOf(businessLine1Pagination.getName());
businessLine1QueryWrapper.lambda().like(BusinessLine1Entity::getName,value);
}
}
if(!isPc){
if(ObjectUtil.isNotEmpty(businessLine1Pagination.getName())){
businessLine1Num++;
String value = businessLine1Pagination.getName() instanceof List ?
JsonUtil.getObjectToString(businessLine1Pagination.getName()) :
String.valueOf(businessLine1Pagination.getName());
businessLine1QueryWrapper.lambda().like(BusinessLine1Entity::getName,value);
}
}
if(businessContact1Num>0){
List<String> businessContact1IdList = businessContact1Service.list(businessContact1QueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getBusinessLineId())).map(t->t.getBusinessLineId()).collect(Collectors.toList());
long count = businessContact1Service.count();
if (count>0){
intersectionList.add(businessContact1IdList);
}
AllIdList.addAll(businessContact1IdList);
}
total+=businessContact1Num;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
businessLine1QueryWrapper.lambda().in(BusinessLine1Entity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
businessLine1QueryWrapper.lambda().and(t->t.in(BusinessLine1Entity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
businessLine1QueryWrapper.lambda().and(t->t.in(BusinessLine1Entity::getId, finalAllRuleIDlist));
}
//假删除标志
businessLine1QueryWrapper.lambda().isNull(BusinessLine1Entity::getDeleteMark);
//排序
if(StringUtil.isEmpty(businessLine1Pagination.getSidx())){
businessLine1QueryWrapper.lambda().orderByDesc(BusinessLine1Entity::getId);
}else{
try {
String sidx = businessLine1Pagination.getSidx();
String[] strs= sidx.split("_name");
BusinessLine1Entity businessLine1Entity = new BusinessLine1Entity();
Field declaredField = businessLine1Entity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
businessLine1QueryWrapper="asc".equals(businessLine1Pagination.getSort().toLowerCase())?businessLine1QueryWrapper.orderByAsc(value):businessLine1QueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<BusinessLine1Entity> page=new Page<>(businessLine1Pagination.getCurrentPage(), businessLine1Pagination.getPageSize());
IPage<BusinessLine1Entity> userIPage=this.page(page, businessLine1QueryWrapper);
return businessLine1Pagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<BusinessLine1Entity> list = new ArrayList();
return businessLine1Pagination.setData(list, list.size());
}
}else{
return this.list(businessLine1QueryWrapper);
}
}
@Override
public BusinessLine1Entity getInfo(String id){
QueryWrapper<BusinessLine1Entity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(BusinessLine1Entity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(BusinessLine1Entity entity){
this.save(entity);
}
@Override
public boolean update(String id, BusinessLine1Entity entity){
return this.updateById(entity);
}
@Override
public void delete(BusinessLine1Entity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** BusinessContact1子表方法 */
@Override
public List<BusinessContact1Entity> getBusinessContact1List(String id,BusinessLine1Pagination businessLine1Pagination){
Map<String, Object> newtabMap=BusinessLine1Constant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="businessContact1";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<BusinessContact1Entity> queryWrapper = new QueryWrapper<>();
queryWrapper = businessContact1Service.getChild(businessLine1Pagination,queryWrapper);
queryWrapper.lambda().eq(BusinessContact1Entity::getBusinessLineId, id);
generaterSwapUtil.wrapperHandle(BusinessLine1Constant.getColumnData(), BusinessLine1Constant.getAppColumnData(), queryWrapper,BusinessContact1Entity.class,"sub",tableName);
return businessContact1Service.list(queryWrapper);
}
/** BusinessContact1子表方法 */
@Override
public List<BusinessContact1Entity> getBusinessContact1List(String id){
QueryWrapper<BusinessContact1Entity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BusinessContact1Entity::getBusinessLineId, id);
return businessContact1Service.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(BusinessLine1Form form,int i) {
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id="";
String countRecover = "";
if (isUp){
id = form.getId();
}
//主表字段验证
if(StringUtil.isEmpty(form.getName())){
return "生产线名称不能为空";
}
if(StringUtil.isNotEmpty(form.getName())){
form.setName(form.getName().trim());
QueryWrapper<BusinessLine1Entity> nameWrapper=new QueryWrapper<>();
nameWrapper.lambda().eq(BusinessLine1Entity::getName,form.getName());
//假删除标志
nameWrapper.lambda().isNull(BusinessLine1Entity::getDeleteMark);
if (isUp){
nameWrapper.lambda().ne(BusinessLine1Entity::getId, id);
}
if((int) this.count(nameWrapper)>0){
countRecover = "生产线名称不能重复";
}
}
//子表字段验证
if (form.getBusinessContact1List()!=null){
for(BusinessContact1Model t : form.getBusinessContact1List()){
if(StringUtil.isNotEmpty(t.getName())){
t.setName(t.getName().trim());
}
else{
return "-姓名不能为空";
}
}
for(BusinessContact1Model t : form.getBusinessContact1List()){
if(StringUtil.isNotEmpty(t.getPhone())){
t.setPhone(t.getPhone().trim());
}
else{
return "-手机号不能为空";
}
}
for(BusinessContact1Model t : form.getBusinessContact1List()){
if(StringUtil.isNotEmpty(t.getEmail())){
t.setEmail(t.getEmail().trim());
}
else{
return "-邮箱不能为空";
}
}
}
return countRecover;
}
/**
* ()
* @param id
* @param businessLine1Form
* @return
*/
@Override
@Transactional
public void saveOrUpdate(BusinessLine1Form businessLine1Form,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
businessLine1Form = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(BusinessLine1Constant.getFormData(),businessLine1Form),BusinessLine1Form.class);
BusinessLine1Entity entity = JsonUtil.getJsonToBean(businessLine1Form, BusinessLine1Entity.class);
if(isSave){
String mainId = id ;
entity.setCode(generaterSwapUtil.getBillNumber("rukudanhao", false));
entity.setId(mainId);
entity.setFlowId(businessLine1Form.getFlowId());
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("rukudanhao", false));
entity.setFlowId(businessLine1Form.getFlowId());
}
this.saveOrUpdate(entity);
//BusinessContact1子表数据新增修改
if(!isSave){
QueryWrapper<BusinessContact1Entity> BusinessContact1queryWrapper = new QueryWrapper<>();
BusinessContact1queryWrapper.lambda().eq(BusinessContact1Entity::getBusinessLineId, entity.getId());
businessContact1Service.remove(BusinessContact1queryWrapper);
}
if (businessLine1Form.getBusinessContact1List()!=null){
List<BusinessContact1Entity> tableField133 = JsonUtil.getJsonToList(businessLine1Form.getBusinessContact1List(),BusinessContact1Entity.class);
for(BusinessContact1Entity entitys : tableField133){
entitys.setId(RandomUtil.uuId());
entitys.setBusinessLineId(entity.getId());
if(isSave){
}else{
}
businessContact1Service.saveOrUpdate(entitys);
}
}
}
}

@ -50,6 +50,8 @@ public class ClassTeamServiceImpl extends ServiceImpl<ClassTeamMapper, ClassTeam
private BusinessContactTeamService businessContactTeamService;
@Autowired
private ClassTeamUseService classTeamUseService;
@Autowired
private ClassTeamMapper classTeamMapper;
@Override
public List<ClassTeamEntity> getList(ClassTeamPagination classTeamPagination){
return getTypeList(classTeamPagination,classTeamPagination.getDataType());
@ -586,4 +588,9 @@ public class ClassTeamServiceImpl extends ServiceImpl<ClassTeamMapper, ClassTeam
}
}
}
@Override
public int queryClassTeamUseInfo(String id) {
return classTeamMapper.queryClassTeamUse(id);
}
}

@ -0,0 +1,634 @@
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.businessline1.*;
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;
/**
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Slf4j
@RestController
@Tag(name = "businessLine1" , description = "scm")
@RequestMapping("/api/scm/BusinessLine1")
public class BusinessLine1Controller {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private BusinessLine1Service businessLine1Service;
@Autowired
private BusinessContact1Service businessContact1Service;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param businessLine1Pagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody BusinessLine1Pagination businessLine1Pagination)throws IOException{
List<BusinessLine1Entity> list= businessLine1Service.getList(businessLine1Pagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (BusinessLine1Entity entity : list) {
if (entity.getDifflag().equals("3")||entity.getDifflag().equals("5")){
Map<String, Object> businessLine1Map=JsonUtil.entityToMap(entity);
businessLine1Map.put("id", businessLine1Map.get("id"));
//副表数据
//子表数据
List<BusinessContact1Entity> businessContact1List = businessLine1Service.getBusinessContact1List(entity.getId(),businessLine1Pagination);
businessLine1Map.put("tableField133",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContact1List)));
realList.add(businessLine1Map);
}
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, BusinessLine1Constant.getFormData(), BusinessLine1Constant.getColumnData(), businessLine1Pagination.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(businessLine1Pagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param businessLine1Form
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid BusinessLine1Form businessLine1Form) {
String b = businessLine1Service.checkForm(businessLine1Form,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
businessLine1Service.saveOrUpdate(businessLine1Form, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody BusinessLine1Pagination businessLine1Pagination) throws IOException {
if (StringUtil.isEmpty(businessLine1Pagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<BusinessLine1Entity> list= businessLine1Service.getList(businessLine1Pagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (BusinessLine1Entity entity : list) {
Map<String, Object> businessLine1Map=JsonUtil.entityToMap(entity);
businessLine1Map.put("id", businessLine1Map.get("id"));
//副表数据
//子表数据
List<BusinessContact1Entity> businessContact1List = businessLine1Service.getBusinessContact1List(entity.getId(),businessLine1Pagination);
businessLine1Map.put("tableField133",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContact1List)));
realList.add(businessLine1Map);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, BusinessLine1Constant.getFormData(), BusinessLine1Constant.getColumnData(), businessLine1Pagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(businessLine1Pagination.getSelectKey())?businessLine1Pagination.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){
ExcelExportEntity tableField133ExcelEntity = new ExcelExportEntity("","tableField133");
List<ExcelExportEntity> tableField133List = new ArrayList<>();
for(String key:keys){
switch(key){
case "code" :
entitys.add(new ExcelExportEntity("生产线编号" ,"code"));
break;
case "name" :
entitys.add(new ExcelExportEntity("生产线名称" ,"name"));
break;
case "simpleName" :
entitys.add(new ExcelExportEntity(" 简称/英文名" ,"simpleName"));
break;
case "type" :
entitys.add(new ExcelExportEntity("类型" ,"type"));
break;
case "parentId" :
entitys.add(new ExcelExportEntity("所属工厂" ,"parentId"));
break;
case "workshopId" :
entitys.add(new ExcelExportEntity("所属车间" ,"workshopId"));
break;
case "status" :
entitys.add(new ExcelExportEntity("状态" ,"status"));
break;
case "description" :
entitys.add(new ExcelExportEntity("描述" ,"description"));
break;
case "tableField133-contactType":
tableField133List.add(new ExcelExportEntity("类型" ,"contactType"));
break;
case "tableField133-name":
tableField133List.add(new ExcelExportEntity("姓名" ,"name"));
break;
case "tableField133-phone":
tableField133List.add(new ExcelExportEntity("手机号" ,"phone"));
break;
case "tableField133-landline":
tableField133List.add(new ExcelExportEntity("座机" ,"landline"));
break;
case "tableField133-email":
tableField133List.add(new ExcelExportEntity("邮箱" ,"email"));
break;
case "tableField133-fax":
tableField133List.add(new ExcelExportEntity("传真" ,"fax"));
break;
case "tableField133-lastModifyTime":
tableField133List.add(new ExcelExportEntity("更新时间" ,"lastModifyTime"));
break;
default:
break;
}
}
if(tableField133List.size() > 0){
tableField133ExcelEntity.setList(tableField133List);
entitys.add(tableField133ExcelEntity);
}
}
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(BusinessLine1Constant.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;
}
@Operation(summary = "上传文件")
@PostMapping("/Uploader")
public ActionResult<Object> Uploader() {
List<MultipartFile> list = UpUtil.getFileAll();
MultipartFile file = list.get(0);
if (file.getOriginalFilename().endsWith(".xlsx") || file.getOriginalFilename().endsWith(".xls")) {
String filePath = XSSEscape.escape(configValueUtil.getTemporaryFilePath());
String fileName = XSSEscape.escape(RandomUtil.uuId() + "." + UpUtil.getFileType(file));
//上传文件
FileInfo fileInfo = FileUploadUtils.uploadFile(file, filePath, fileName);
DownloadVO vo = DownloadVO.builder().build();
vo.setName(fileInfo.getFilename());
return ActionResult.success(vo);
} else {
return ActionResult.fail("选择文件不符合导入");
}
}
/**
*
*
* @return
*/
@Operation(summary = "模板下载")
@GetMapping("/TemplateDownload")
public ActionResult<DownloadVO> TemplateDownload(){
DownloadVO vo = DownloadVO.builder().build();
UserInfo userInfo = userProvider.get();
Map<String, Object> dataMap = new HashMap<>();
//主表对象
List<ExcelExportEntity> entitys = new ArrayList<>();
//以下添加字段
entitys.add(new ExcelExportEntity("生产线编号" ,"code"));
dataMap.put("code", "系统自动生成");
entitys.add(new ExcelExportEntity("生产线名称" ,"name"));
entitys.add(new ExcelExportEntity("类型" ,"type"));
entitys.add(new ExcelExportEntity("所属工厂" ,"parentId"));
entitys.add(new ExcelExportEntity("状态" ,"status"));
entitys.add(new ExcelExportEntity("所属车间" ,"workshopId"));
//tableField133子表对象
ExcelExportEntity tableField133ExcelEntity = new ExcelExportEntity("","tableField133");
List<ExcelExportEntity> tableField133ExcelEntityList = new ArrayList<>();
Map<String, Object> tableField133ChildData = new HashMap<>();
List<Map<String, Object>> tableField133ChildDataList = new ArrayList<>();
tableField133ExcelEntityList.add(new ExcelExportEntity("类型" ,"contactType"));
tableField133ExcelEntityList.add(new ExcelExportEntity("姓名" ,"name"));
tableField133ExcelEntityList.add(new ExcelExportEntity("手机号" ,"phone"));
tableField133ExcelEntityList.add(new ExcelExportEntity("邮箱" ,"email"));
tableField133ChildDataList.add(tableField133ChildData);
dataMap.put("tableField133",tableField133ChildDataList);
tableField133ExcelEntity.setList(tableField133ExcelEntityList);
entitys.add(tableField133ExcelEntity);
List<Map<String, Object>> list = new ArrayList<>();
list.add(dataMap);
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<>());
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(BusinessLine1Constant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
list = VisualUtils.complexHeaderDataHandel(list, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String fileName = "加工生产线模板" + DateUtil.dateNow("yyyyMMddHHmmss") + ".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 ActionResult.success(vo);
}
/**
*
*
* @return
*/
@Operation(summary = "导入预览" )
@GetMapping("/ImportPreview")
public ActionResult<Map<String, Object>> ImportPreview(String fileName) throws Exception {
Map<String, Object> headAndDataMap = new HashMap<>(2);
String filePath = FileUploadUtils.getLocalBasePath() + configValueUtil.getTemporaryFilePath();
FileUploadUtils.downLocal(configValueUtil.getTemporaryFilePath(), filePath, fileName);
File temporary = new File(XSSEscape.escapePath(filePath + fileName));
int headerRowIndex = 2;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(headerRowIndex);
params.setNeedVerify(true);
try {
List<BusinessLine1ExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, BusinessLine1ExcelVO.class, params);
// 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("code","生产线编号"));
columns.add(new ExcelImFieldModel("name","生产线名称"));
columns.add(new ExcelImFieldModel("type","类型"));
columns.add(new ExcelImFieldModel("parentId","所属工厂"));
columns.add(new ExcelImFieldModel("status","状态"));
columns.add(new ExcelImFieldModel("workshopId","所属车间"));
//tableField133子表对象
List<ExcelImFieldModel> tableField133columns = new ArrayList<>();
tableField133columns.add(new ExcelImFieldModel("contactType" ,"类型"));
tableField133columns.add(new ExcelImFieldModel("name" ,"姓名"));
tableField133columns.add(new ExcelImFieldModel("phone" ,"手机号"));
tableField133columns.add(new ExcelImFieldModel("email" ,"邮箱"));
columns.add(new ExcelImFieldModel("tableField133","",tableField133columns));
headAndDataMap.put("dataRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList)));
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
} catch (Exception e){
e.printStackTrace();
return ActionResult.fail("表头名称不可更改,表头行不能删除");
}
return ActionResult.success(headAndDataMap);
}
/**
*
*
* @return
*/
@Operation(summary = "导入数据" )
@PostMapping("/ImportData")
public ActionResult<ExcelImportModel> ImportData(@RequestBody VisualImportModel visualImportModel) throws Exception {
List<Map<String, Object>> listData=new ArrayList<>();
for(Map<String, Object> map : visualImportModel.getList()){
listData.add(map);
}
ImportFormCheckUniqueModel uniqueModel = new ImportFormCheckUniqueModel();
uniqueModel.setDbLinkId(BusinessLine1Constant.DBLINKID);
uniqueModel.setUpdate(Objects.equals("1", "2"));
uniqueModel.setFlowId(visualImportModel.getFlowId()); ExcelImportModel excelImportModel = generaterSwapUtil.importData(BusinessLine1Constant.getFormData(),listData,uniqueModel,
BusinessLine1Constant.TABLEFIELDKEY,BusinessLine1Constant.getTableList());
List<ImportDataModel> importDataModel = uniqueModel.getImportDataModel();
for (ImportDataModel model : importDataModel) {
String id = model.getId();
Map<String, Object> result = model.getResultData();
if(StringUtil.isNotEmpty(id)){
update(id, JsonUtil.getJsonToBean(result,BusinessLine1Form.class), true);
}else {
create(RandomUtil.uuId(), JsonUtil.getJsonToBean(result,BusinessLine1Form.class));
}
}
return ActionResult.success(excelImportModel);
}
/**
*
*
* @return
*/
@Operation(summary = "导出异常报告")
@PostMapping("/ImportExceptionData")
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
DownloadVO vo=DownloadVO.builder().build();
List<BusinessLine1ExcelErrorVO> businessLine1VOList = JsonUtil.getJsonToList(visualImportModel.getList(), BusinessLine1ExcelErrorVO.class);
UserInfo userInfo = userProvider.get();
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams,
BusinessLine1ExcelErrorVO.class, businessLine1VOList);
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) {
e.printStackTrace();
}
return ActionResult.success(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 businessLine1Form
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid BusinessLine1Form businessLine1Form,
@RequestParam(value = "isImport", required = false) boolean isImport){
businessLine1Form.setId(id);
if (!isImport) {
String b = businessLine1Service.checkForm(businessLine1Form,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
BusinessLine1Entity entity= businessLine1Service.getInfo(id);
if(entity!=null){
try{
businessLine1Service.saveOrUpdate(businessLine1Form,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){
BusinessLine1Entity entity= businessLine1Service.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);
businessLine1Service.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
BusinessLine1Entity entity= businessLine1Service.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> businessLine1Map=JsonUtil.entityToMap(entity);
businessLine1Map.put("id", businessLine1Map.get("id"));
//副表数据
//子表数据
List<BusinessContact1Entity> businessContact1List = businessLine1Service.getBusinessContact1List(entity.getId());
businessLine1Map.put("tableField133",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContact1List)));
businessLine1Map = generaterSwapUtil.swapDataDetail(businessLine1Map,BusinessLine1Constant.getFormData(),"521949393889270917",false);
return ActionResult.success(businessLine1Map);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
BusinessLine1Entity entity= businessLine1Service.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> businessLine1Map=JsonUtil.entityToMap(entity);
businessLine1Map.put("id", businessLine1Map.get("id"));
//副表数据
//子表数据
List<BusinessContact1Entity> businessContact1List = businessLine1Service.getBusinessContact1List(entity.getId());
businessLine1Map.put("businessContact1List",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(businessContact1List)));
businessLine1Map = generaterSwapUtil.swapDataForm(businessLine1Map,BusinessLine1Constant.getFormData(),BusinessLine1Constant.TABLEFIELDKEY,BusinessLine1Constant.TABLERENAMES);
return ActionResult.success(businessLine1Map);
}
}

@ -83,6 +83,27 @@ public class BusinessLineController {
return ActionResult.success(listVO);
}
/**
*
*
* @return
*/
@Operation(summary = "获取工厂和加工车间树形树形")
@GetMapping("/WorkTree")
public ActionResult<List<BusinessLineSonTree>> WorkTree() {
List<BusinessLineEntity> list = businessLineService.list();
List<BusinessLineEntity> workTreeList =new ArrayList<>();
for (BusinessLineEntity businessLineEntity:list){
if (businessLineEntity.getDiffFlag().equals("3")||businessLineEntity.getDiffFlag().equals("5")){
workTreeList.add(businessLineEntity);
}
}
List<BusinessLineModel> models = JsonUtil.getJsonToList(workTreeList, BusinessLineModel.class);
List<SumTree<BusinessLineModel>> trees = TreeDotUtils.convertListToTreeDot(models);
List<BusinessLineSonTree> listVO = JsonUtil.getJsonToList(trees, BusinessLineSonTree.class);
return ActionResult.success(listVO);
}
/**
*

@ -90,6 +90,11 @@ public class ClassTeamController {
@PostMapping("/getList")
public ActionResult list(@RequestBody ClassTeamPagination classTeamPagination)throws IOException{
List<ClassTeamEntity> list= classTeamService.getList(classTeamPagination);
for (ClassTeamEntity classTeamEntity :list){
classTeamEntity.setClassTeamUseNum(classTeamService.queryClassTeamUseInfo(classTeamEntity.getId()));
}
List<Map<String, Object>> realList=new ArrayList<>();
for (ClassTeamEntity entity : list) {
Map<String, Object> classTeamMap=JsonUtil.entityToMap(entity);

@ -77,4 +77,7 @@ public class BomEntity {
@TableField(exist = false)
private String categoryName;
@TableField(exist = false)
private String productTypeId;
}

@ -0,0 +1,49 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
@TableName("jg_business_contact")
public class BusinessContact1Entity {
@TableId(value ="ID" )
private String id;
@TableField("BUSINESS_LINE_ID")
private String businessLineId;
@TableField(value = "CONTACT_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String contactType;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField(value = "PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String phone;
@TableField(value = "LANDLINE" , updateStrategy = FieldStrategy.IGNORED)
private String landline;
@TableField(value = "EMAIL" , updateStrategy = FieldStrategy.IGNORED)
private String email;
@TableField(value = "FAX" , updateStrategy = FieldStrategy.IGNORED)
private String fax;
@TableField("F_CREATOR_TIME")
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;
}

@ -0,0 +1,115 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 线
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
@TableName("jg_business_line")
public class BusinessLine1Entity {
@TableId(value ="ID" )
private String id;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField(value = "NAME" , updateStrategy = FieldStrategy.IGNORED)
private String name;
@TableField(value = "SIMPLE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String simpleName;
@TableField("LOGO")
private String logo;
@TableField(value = "PARENT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String parentId;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type;
@TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED)
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(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
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("WORKSHOP_AREA")
private String workshopArea;
@TableField(value = "WORKSHOP_ID" , updateStrategy = FieldStrategy.IGNORED)
private String workshopId;
@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;
@TableField("F_FLOW_TASK_ID")
private String flowTaskId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
}

@ -73,4 +73,7 @@ public class ClassTeamEntity {
private String companyId;
@TableField(value = "department_id" , fill = FieldFill.INSERT)
private String departmentId;
@TableField(exist = false)
private Integer classTeamUseNum;
}

@ -0,0 +1,45 @@
package jnpf.model.businessline1;
import lombok.Data;
import java.sql.Time;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import java.math.BigDecimal;
import java.util.List;
/**
*
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
public class BusinessContact1ExcelVO{
/** 类型 **/
@JSONField(name = "contactType")
@Excel(name = "类型",orderNum = "1", isImportField = "true" )
private String contactType;
/** 姓名 **/
@JSONField(name = "name")
@Excel(name = "姓名",orderNum = "1", isImportField = "true" )
private String name;
/** 手机号 **/
@JSONField(name = "phone")
@Excel(name = "手机号",orderNum = "1", isImportField = "true" )
private String phone;
/** 邮箱 **/
@JSONField(name = "email")
@Excel(name = "邮箱",orderNum = "1", isImportField = "true" )
private String email;
}

@ -0,0 +1,47 @@
package jnpf.model.businessline1;
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;
/**
*
* businessLine1
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-04
*/
@Data
public class BusinessContact1Model {
/** 类型 **/
@Excel(name = "类型",orderNum = "1",isImportField = "true")
@JSONField(name = "contactType")
private Object contactType;
/** 姓名 **/
@Excel(name = "姓名",orderNum = "1",isImportField = "true")
@JSONField(name = "name")
private String name;
/** 手机号 **/
@Excel(name = "手机号",orderNum = "1",isImportField = "true")
@JSONField(name = "phone")
private String phone;
/** 座机 **/
@JSONField(name = "landline")
private String landline;
/** 邮箱 **/
@Excel(name = "邮箱",orderNum = "1",isImportField = "true")
@JSONField(name = "email")
private String email;
/** 传真 **/
@JSONField(name = "fax")
private String fax;
/** 更新时间 **/
@JSONField(name = "lastModifyTime")
private String lastModifyTime;
}

@ -0,0 +1,22 @@
package jnpf.model.businessline1;
import lombok.Data;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
public class BusinessLine1ExcelErrorVO extends BusinessLine1ExcelVO{
@Excel(name = "异常原因",orderNum = "999")
@JSONField(name = "errorsInfo")
private String errorsInfo;
}

@ -0,0 +1,60 @@
package jnpf.model.businessline1;
import lombok.Data;
import java.sql.Time;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import java.math.BigDecimal;
import java.util.List;
/**
*
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
public class BusinessLine1ExcelVO{
/** 生产线编号 **/
@JSONField(name = "code")
@Excel(name = "生产线编号",orderNum = "1", isImportField = "true" )
private String code;
/** 生产线名称 **/
@JSONField(name = "name")
@Excel(name = "生产线名称",orderNum = "1", isImportField = "true" )
private String name;
/** 类型 **/
@JSONField(name = "type")
@Excel(name = "类型",orderNum = "1", isImportField = "true" )
private String type;
/** 所属工厂 **/
@JSONField(name = "parentId")
@Excel(name = "所属工厂",orderNum = "1", isImportField = "true" )
private String parentId;
/** 状态 **/
@JSONField(name = "status")
@Excel(name = "状态",orderNum = "1", isImportField = "true" )
private String status;
/** 所属车间 **/
@JSONField(name = "workshopId")
@Excel(name = "所属车间",orderNum = "1", isImportField = "true" )
private String workshopId;
@JsonProperty("tableField133")
@ExcelCollection(name="",orderNum = "4")
private List<BusinessContact1ExcelVO> tableField133;
}

@ -0,0 +1,53 @@
package jnpf.model.businessline1;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
public class BusinessLine1Form {
/** 主键 */
private String id;
/** 子表数据 **/
@JsonProperty("businessContact1List")
private List<BusinessContact1Model> businessContact1List;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 生产线编号 **/
@JsonProperty("code")
private String code;
/** 生产线名称 **/
@JsonProperty("name")
private String name;
/** 简称/英文名 **/
@JsonProperty("simpleName")
private String simpleName;
/** 类型 **/
@JsonProperty("type")
private Object type;
/** 所属工厂 **/
@JsonProperty("parentId")
private Object parentId;
/** 所属车间 **/
@JsonProperty("workshopId")
private Object workshopId;
/** 状态 **/
@JsonProperty("status")
private String status;
/** 描述 **/
@JsonProperty("description")
private String description;
}

@ -0,0 +1,42 @@
package jnpf.model.businessline1;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* businessLine1
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-04
*/
@Data
public class BusinessLine1Pagination 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("code")
private Object code;
/** 类型 */
@JsonProperty("type")
private Object type;
/** tree */
@JsonProperty("name")
private Object name;
@JsonProperty("parentId")
private Object parentId;
}

@ -17,4 +17,10 @@ public class BusinessLineModel extends SumTree {
private List<String> businessLineIds;
private String parentId;
@Schema(description = "类型区分")
private String diffFlag;
@Schema(description = "类型区分")
private String difflag;
}

@ -25,4 +25,10 @@ public class BusinessLineSonTree {
private Boolean hasChildren;
@Schema(description = "下级菜单列表")
private List<BusinessLineSonTree> children;
@Schema(description = "类型区分")
private String diffFlag;
@Schema(description = "类型区分")
private String difflag;
}

@ -81,16 +81,20 @@
<el-table-column prop="bomName" label="商品名称" align="left" min-width="120">
<template #default="scope">
<el-row>
<el-col :span="8">
<img src="" alt="">
<el-col>
{{ scope.row.productCode }}
</el-col>
<el-col :span="12">
{{ scope.row.bomName }}
<el-col>
{{ scope.row.productName }}
</el-col>
</el-row>
</template>
</el-table-column>
<el-table-column prop="bomCode" label="类型" align="left" min-width="120">
<el-table-column prop="productTypeId" label="类型" align="left" min-width="120">
<template slot-scope="scope">
{{ scope.row.productTypeId}}
</template>
</el-table-column>
<!-- <el-table-column prop="tableField106" label="" align="center">
@ -142,14 +146,14 @@
</el-table-column>
<el-table-column prop="bomCode" label="库存单位" align="left" min-width="120">
</el-table-column>
<el-table-column prop="bomCode" label="规格" align="left" min-width="120">
<el-table-column prop="productSpec" label="规格" align="left" min-width="120">
</el-table-column>
<el-table-column prop="bomCode" label="商品分类" align="left" min-width="120">
<el-table-column prop="categoryName" label="商品分类" align="left" min-width="120">
</el-table-column>
<el-table-column prop="bomCode" label="商品类目" align="left" min-width="120">
<!-- <el-table-column prop="bomCode" label="商品类目" align="left" min-width="120">
</el-table-column>
<el-table-column prop="bomCode" label="尺寸单位" align="left" min-width="120">
</el-table-column>
</el-table-column> -->
<el-table-column prop="flowState" label="状态" width="100">
<template slot-scope="scope" v-if="!scope.row.top">
@ -271,7 +275,10 @@ export default {
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
productTypeIdOptions: [{ "fullName": "实物商品", "id": "1" }, { "fullName": "虚拟商品", "id": "2" }, { "fullName": "设备/器材", "id": "3" }, { "fullName": "耗材/辅材", "id": "4" }],
bomStatusOptions: [{ "fullName": "启用", "id": "1" }, { "fullName": "禁用", "id": "2" }],
bomStatusProps: { "label": "fullName", "value": "id" },
tableField106_productIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" }, { "label": "规格", "value": "spec" },],
tableField118_productIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" }, { "label": "规格", "value": "spec" },],

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -70,9 +70,6 @@
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.tableField114" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="contactType" label="联系人类型" >
@ -122,9 +119,6 @@
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.tableField123" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="belongUserId" label="员工姓名" >

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -6,513 +6,494 @@
<template>
<div class="JNPF-common-layout">
<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.timeCode" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="班组名称">
<el-input v-model="query.timeName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<JnpfSelect v-model="query.timeStatus" placeholder="请选择" clearable
:options="timeStatusOptions"
:props="timeStatusProps" >
</JnpfSelect>
</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="timeCode"
label="班组编号" align="left"
>
</el-table-column>
<el-table-column
prop="timeName"
label="班组名称" align="left"
>
</el-table-column>
<el-table-column
prop="startTime"
label="开始时间" align="left"
>
</el-table-column>
<el-table-column
prop="endTime"
label="结束时间" align="left"
>
</el-table-column>
<el-table-column
prop="timeNm"
label="班组简称" align="left"
>
</el-table-column>
<el-table-column label="状态" prop="timeStatus" algin="left"
>
<template slot-scope="scope">
{{ scope.row.timeStatus}}
</template>
</el-table-column>
<el-table-column label="操作"
fixed="right" width="150" >
<template slot-scope="scope" >
<el-button type="text"
@click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" v-has="'btn_remove'" @click="handleDel(scope.row.id)">
</el-button>
<el-button type="text" v-has="'btn_detail'"
@click="goDetail(scope.row.id)">详情
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
</div>
<div class="JNPF-common-layout">
<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.timeCode" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="班组名称">
<el-input v-model="query.timeName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="状态">
<JnpfSelect v-model="query.timeStatus" placeholder="请选择" clearable
:options="timeStatusOptions" :props="timeStatusProps">
</JnpfSelect>
</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-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<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" />
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="timeCode" label="班组编号" align="left">
</el-table-column>
<el-table-column prop="timeName" label="班组名称" align="left">
</el-table-column>
<el-table-column prop="startTime" label="开始时间" align="left">
</el-table-column>
<el-table-column prop="endTime" label="结束时间" align="left">
</el-table-column>
<el-table-column prop="timeNm" label="班组简称" align="left">
</el-table-column>
<el-table-column label="状态" prop="timeStatus" algin="left">
<template slot-scope="scope">
{{ scope.row.timeStatus}}
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">
</el-button>
<el-button type="text" class="JNPF-table-delBtn" v-has="'btn_remove'"
@click="handleDel(scope.row.id)">删除
</el-button>
<el-button type="text" v-has="'btn_detail'" @click="goDetail(scope.row.id)">
</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" />
<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 JNPFForm from './form'
import Detail from './Detail'
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'
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
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: {
JNPFForm,
Detail,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
export default {
components: {
JNPFForm,
Detail,
ExportBox, ToFormDetail, SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
timeCode:undefined,
timeName:undefined,
timeStatus:undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
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,
timeStatusOptions:[{"fullName":"启用","id":"1"},{"fullName":"禁用","id":"2"}],
timeStatusProps:{"label":"fullName","value":"id" },
interfaceRes: {
},
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
timeCode: undefined,
timeName: undefined,
timeStatus: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
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,
timeStatusOptions: [{ "fullName": "启用", "id": "1" }, { "fullName": "禁用", "id": "2" }],
timeStatusProps: { "label": "fullName", "value": "id" },
interfaceRes: {
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
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
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
}
}
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
})
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
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()
},
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:'522729389880782341',
type:1,
};
request({
url: `/api/scm/ClassTime/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/ClassTime/${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/ClassTime")
})
},
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/ClassTime/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, isDetail) {
let id = row?row.id:""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail,this.list)
})
},
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/ClassTime/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()
},
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()
},
})
} 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()
},
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: '522729389880782341',
type: 1,
};
request({
url: `/api/scm/ClassTime/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/ClassTime/${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/ClassTime")
})
},
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/ClassTime/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, isDetail) {
let id = row ? row.id : ""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list)
})
},
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/ClassTime/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()
},
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>

@ -2,416 +2,413 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12" >
<jnpf-form-tip-item
label="工序分类编码" prop="categoryCode" >
<JnpfInput v-model="dataForm.categoryCode" @change="changeData('categoryCode',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item
label="工序分类名称" prop="categoryName" >
<JnpfInput v-model="dataForm.categoryName" @change="changeData('categoryName',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="工序分类描述" prop="categoryDescription" >
<JnpfInput v-model="dataForm.categoryDescription" @change="changeData('categoryDescription',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'" :close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12">
<jnpf-form-tip-item label="工序分类编码" prop="categoryCode">
<JnpfInput v-model="dataForm.categoryCode" @change="changeData('categoryCode',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="工序分类名称" prop="categoryName">
<JnpfInput v-model="dataForm.categoryName" @change="changeData('categoryName',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="工序分类描述" prop="categoryDescription">
<JnpfInput v-model="dataForm.categoryDescription"
@change="changeData('categoryDescription',-1)" placeholder="请输入" clearable
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false" />
</el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{'上一条'}}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{'下一条'}}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{'上一条'}}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{'下一条'}}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
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 {
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: {
categoryCode : undefined,
categoryName : undefined,
categoryDescription : undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
categoryName: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
},
childIndex:-1,
isEdit:false,
interfaceRes: {
categoryCode:[] ,
categoryName:[] ,
categoryDescription:[] ,
},
import request from '@/utils/request'
import { mapGetters } from "vuex";
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 {
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: {
categoryCode: undefined,
categoryName: undefined,
categoryDescription: undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
categoryName: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
},
childIndex: -1,
isEdit: false,
interfaceRes: {
categoryCode: [],
categoryName: [],
categoryDescription: [],
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() { },
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/ProcessClassification/'+ id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
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(){
},
clearData(){
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id,isDetail,allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/ProcessClassification/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
}else{
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/ProcessClassification/' + id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
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() {
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/ProcessClassification/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
} else {
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
let _data =this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/ProcessClassification',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}else{
request({
url: '/api/scm/ProcessClassification/'+this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(()=>{
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
openSelectDialog(key) {
this.currTableConf=this.addTableConf[key]
this.currVmodel=key
this.selectDialogVisible = true
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/ProcessClassification',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.$refs.selectDialog.init()
this.clearData()
this.initDefaultData()
})
},
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
},
},
}
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
} else {
request({
url: '/api/scm/ProcessClassification/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
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>

@ -6,481 +6,473 @@
<template>
<div class="JNPF-common-layout">
<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.categoryCode" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="工序分类名称">
<el-input v-model="query.categoryName" placeholder="请输入" clearable> </el-input>
</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="categoryCode"
label="工序分类编码" align="left"
>
</el-table-column>
<el-table-column
prop="categoryName"
label="工序分类名称" align="left"
>
</el-table-column>
<el-table-column label="操作"
fixed="right" width="150" >
<template slot-scope="scope" >
<el-button type="text"
@click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" v-has="'btn_remove'" @click="handleDel(scope.row.id)">
</el-button>
<el-button type="text" v-has="'btn_detail'"
@click="goDetail(scope.row.id)">详情
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
</div>
<div class="JNPF-common-layout">
<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.categoryCode" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="工序分类名称">
<el-input v-model="query.categoryName" placeholder="请输入" clearable> </el-input>
</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-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<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" />
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="categoryCode" label="工序分类编码" align="left">
</el-table-column>
<el-table-column prop="categoryName" label="工序分类名称" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">
</el-button>
<el-button type="text" class="JNPF-table-delBtn" v-has="'btn_remove'"
@click="handleDel(scope.row.id)">删除
</el-button>
<el-button type="text" v-has="'btn_detail'" @click="goDetail(scope.row.id)">
</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" />
<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 JNPFForm from './form'
import Detail from './Detail'
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'
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
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: {
JNPFForm,
Detail,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
export default {
components: {
JNPFForm,
Detail,
ExportBox, ToFormDetail, SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
categoryCode:undefined,
categoryName:undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
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,
interfaceRes: {
},
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
categoryCode: undefined,
categoryName: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
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,
interfaceRes: {
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
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
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
}
}
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
})
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
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()
},
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:'522320367801345093',
type:1,
};
request({
url: `/api/scm/ProcessClassification/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/ProcessClassification/${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/ProcessClassification")
})
},
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/ProcessClassification/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, isDetail) {
let id = row?row.id:""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail,this.list)
})
},
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/ProcessClassification/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()
},
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()
},
})
} 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()
},
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: '522320367801345093',
type: 1,
};
request({
url: `/api/scm/ProcessClassification/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/ProcessClassification/${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/ProcessClassification")
})
},
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/ProcessClassification/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, isDetail) {
let id = row ? row.id : ""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list)
})
},
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/ProcessClassification/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()
},
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>

@ -104,6 +104,14 @@
{{ scope.row.status}}
</template>
</el-table-column>
<el-table-column prop="creatorTime" label="添加时间" align="left">
</el-table-column>
<el-table-column prop="creatorUserId" label="添加人" align="left">
</el-table-column>
<el-table-column prop="lastModifyTime" label="更新时间" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">

Loading…
Cancel
Save