投递柜设备画面重构

master
guochaojie 5 months ago
parent c4ce8b2d14
commit 30a2209c05

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.mapper.NxRecycleDeviceMapper"> <mapper namespace="jnpf.mapper.RecycleDeviceMapper">

@ -1,16 +1,16 @@
package jnpf.mapper; package jnpf.mapper;
import jnpf.entity.NxRecycleDeviceEntity; import jnpf.entity.RecycleDeviceEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* NxRecycleDevice *
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-05-24 * 2024-05-29
*/ */
public interface NxRecycleDeviceMapper extends BaseMapper<NxRecycleDeviceEntity> { public interface RecycleDeviceMapper extends BaseMapper<RecycleDeviceEntity> {
} }

@ -1,35 +0,0 @@
package jnpf.service;
import jnpf.model.nxrecycledevice.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* NxRecycleDevice
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-05-24
*/
public interface NxRecycleDeviceService extends IService<NxRecycleDeviceEntity> {
List<NxRecycleDeviceEntity> getList(NxRecycleDevicePagination nxRecycleDevicePagination);
List<NxRecycleDeviceEntity> getTypeList(NxRecycleDevicePagination nxRecycleDevicePagination,String dataType);
NxRecycleDeviceEntity getInfo(String id);
void delete(NxRecycleDeviceEntity entity);
void create(NxRecycleDeviceEntity entity);
boolean update(String id, NxRecycleDeviceEntity entity);
//子表方法
//副表数据方法
String checkForm(NxRecycleDeviceForm form,int i);
void saveOrUpdate(NxRecycleDeviceForm nxRecycleDeviceForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.recycledevice.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-05-29
*/
public interface RecycleDeviceService extends IService<RecycleDeviceEntity> {
List<RecycleDeviceEntity> getList(RecycleDevicePagination recycleDevicePagination);
List<RecycleDeviceEntity> getTypeList(RecycleDevicePagination recycleDevicePagination,String dataType);
RecycleDeviceEntity getInfo(String id);
void delete(RecycleDeviceEntity entity);
void create(RecycleDeviceEntity entity);
boolean update(String id, RecycleDeviceEntity entity);
//子表方法
//副表数据方法
String checkForm(RecycleDeviceForm form,int i);
void saveOrUpdate(RecycleDeviceForm recycleDeviceForm,String id, boolean isSave) throws Exception;
}

@ -1,297 +0,0 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.NxRecycleDeviceMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.nxrecycledevice.*;
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;
/**
*
* NxRecycleDevice
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-05-24
*/
@Service
public class NxRecycleDeviceServiceImpl extends ServiceImpl<NxRecycleDeviceMapper, NxRecycleDeviceEntity> implements NxRecycleDeviceService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<NxRecycleDeviceEntity> getList(NxRecycleDevicePagination nxRecycleDevicePagination){
return getTypeList(nxRecycleDevicePagination,nxRecycleDevicePagination.getDataType());
}
/** 列表查询 */
@Override
public List<NxRecycleDeviceEntity> getTypeList(NxRecycleDevicePagination nxRecycleDevicePagination,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 ? NxRecycleDeviceConstant.getAppColumnData() : NxRecycleDeviceConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int nxRecycleDeviceNum =0;
QueryWrapper<NxRecycleDeviceEntity> nxRecycleDeviceQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(nxRecycleDevicePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = nxRecycleDevicePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<NxRecycleDeviceEntity> nxRecycleDeviceSuperWrapper = new QueryWrapper<>();
nxRecycleDeviceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxRecycleDeviceSuperWrapper,NxRecycleDeviceEntity.class,queryJson,"0"));
int nxRecycleDeviceNum1 = nxRecycleDeviceSuperWrapper.getExpression().getNormal().size();
if (nxRecycleDeviceNum1>0){
List<String> nxRecycleDeviceList =this.list(nxRecycleDeviceSuperWrapper).stream().map(NxRecycleDeviceEntity::getId).collect(Collectors.toList());
allSuperList.addAll(nxRecycleDeviceList);
intersectionSuperList.add(nxRecycleDeviceList);
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<NxRecycleDeviceEntity> nxRecycleDeviceSuperWrapper = new QueryWrapper<>();
nxRecycleDeviceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(nxRecycleDeviceSuperWrapper,NxRecycleDeviceEntity.class,ruleJson,"0"));
int nxRecycleDeviceNum1 = nxRecycleDeviceSuperWrapper.getExpression().getNormal().size();
if (nxRecycleDeviceNum1>0){
List<String> nxRecycleDeviceList =this.list(nxRecycleDeviceSuperWrapper).stream().map(NxRecycleDeviceEntity::getId).collect(Collectors.toList());
allRuleList.addAll(nxRecycleDeviceList);
intersectionRuleList.add(nxRecycleDeviceList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxRecycleDeviceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxRecycleDeviceQueryWrapper,NxRecycleDeviceEntity.class,nxRecycleDevicePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxRecycleDeviceObj)){
return new ArrayList<>();
} else {
nxRecycleDeviceQueryWrapper = (QueryWrapper<NxRecycleDeviceEntity>)nxRecycleDeviceObj;
if( nxRecycleDeviceQueryWrapper.getExpression().getNormal().size()>0){
nxRecycleDeviceNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object nxRecycleDeviceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(nxRecycleDeviceQueryWrapper,NxRecycleDeviceEntity.class,nxRecycleDevicePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(nxRecycleDeviceObj)){
return new ArrayList<>();
} else {
nxRecycleDeviceQueryWrapper = (QueryWrapper<NxRecycleDeviceEntity>)nxRecycleDeviceObj;
if( nxRecycleDeviceQueryWrapper.getExpression().getNormal().size()>0){
nxRecycleDeviceNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(nxRecycleDevicePagination.getDeviceCode())){
nxRecycleDeviceNum++;
String value = nxRecycleDevicePagination.getDeviceCode() instanceof List ?
JsonUtil.getObjectToString(nxRecycleDevicePagination.getDeviceCode()) :
String.valueOf(nxRecycleDevicePagination.getDeviceCode());
nxRecycleDeviceQueryWrapper.lambda().like(NxRecycleDeviceEntity::getDeviceCode,value);
}
if(ObjectUtil.isNotEmpty(nxRecycleDevicePagination.getDeviceName())){
nxRecycleDeviceNum++;
String value = nxRecycleDevicePagination.getDeviceName() instanceof List ?
JsonUtil.getObjectToString(nxRecycleDevicePagination.getDeviceName()) :
String.valueOf(nxRecycleDevicePagination.getDeviceName());
nxRecycleDeviceQueryWrapper.lambda().like(NxRecycleDeviceEntity::getDeviceName,value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
nxRecycleDeviceQueryWrapper.lambda().in(NxRecycleDeviceEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
nxRecycleDeviceQueryWrapper.lambda().and(t->t.in(NxRecycleDeviceEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
nxRecycleDeviceQueryWrapper.lambda().and(t->t.in(NxRecycleDeviceEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(nxRecycleDevicePagination.getSidx())){
nxRecycleDeviceQueryWrapper.lambda().orderByDesc(NxRecycleDeviceEntity::getId);
}else{
try {
String sidx = nxRecycleDevicePagination.getSidx();
String[] strs= sidx.split("_name");
NxRecycleDeviceEntity nxRecycleDeviceEntity = new NxRecycleDeviceEntity();
Field declaredField = nxRecycleDeviceEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
nxRecycleDeviceQueryWrapper="asc".equals(nxRecycleDevicePagination.getSort().toLowerCase())?nxRecycleDeviceQueryWrapper.orderByAsc(value):nxRecycleDeviceQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<NxRecycleDeviceEntity> page=new Page<>(nxRecycleDevicePagination.getCurrentPage(), nxRecycleDevicePagination.getPageSize());
IPage<NxRecycleDeviceEntity> userIPage=this.page(page, nxRecycleDeviceQueryWrapper);
return nxRecycleDevicePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<NxRecycleDeviceEntity> list = new ArrayList();
return nxRecycleDevicePagination.setData(list, list.size());
}
}else{
return this.list(nxRecycleDeviceQueryWrapper);
}
}
@Override
public NxRecycleDeviceEntity getInfo(String id){
QueryWrapper<NxRecycleDeviceEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(NxRecycleDeviceEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(NxRecycleDeviceEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, NxRecycleDeviceEntity entity){
return this.updateById(entity);
}
@Override
public void delete(NxRecycleDeviceEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(NxRecycleDeviceForm 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.getDeviceCode())){
return "设备编码不能为空";
}
if(StringUtil.isNotEmpty(form.getDeviceCode())){
form.setDeviceCode(form.getDeviceCode().trim());
QueryWrapper<NxRecycleDeviceEntity> deviceCodeWrapper=new QueryWrapper<>();
deviceCodeWrapper.lambda().eq(NxRecycleDeviceEntity::getDeviceCode,form.getDeviceCode());
if (isUp){
deviceCodeWrapper.lambda().ne(NxRecycleDeviceEntity::getId, id);
}
if((int) this.count(deviceCodeWrapper)>0){
countRecover = "设备编码不能重复";
}
}
if(StringUtil.isEmpty(form.getDeviceName())){
return "设备名称不能为空";
}
if(StringUtil.isEmpty(form.getAddress())){
return "地址不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param nxRecycleDeviceForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(NxRecycleDeviceForm nxRecycleDeviceForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
nxRecycleDeviceForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(NxRecycleDeviceConstant.getFormData(),nxRecycleDeviceForm),NxRecycleDeviceForm.class);
NxRecycleDeviceEntity entity = JsonUtil.getJsonToBean(nxRecycleDeviceForm, NxRecycleDeviceEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
}else{
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,305 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.RecycleDeviceMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.recycledevice.*;
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;
/**
*
*
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-05-29
*/
@Service
public class RecycleDeviceServiceImpl extends ServiceImpl<RecycleDeviceMapper, RecycleDeviceEntity> implements RecycleDeviceService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<RecycleDeviceEntity> getList(RecycleDevicePagination recycleDevicePagination){
return getTypeList(recycleDevicePagination,recycleDevicePagination.getDataType());
}
/** 列表查询 */
@Override
public List<RecycleDeviceEntity> getTypeList(RecycleDevicePagination recycleDevicePagination,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 ? RecycleDeviceConstant.getAppColumnData() : RecycleDeviceConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int recycleDeviceNum =0;
QueryWrapper<RecycleDeviceEntity> recycleDeviceQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(recycleDevicePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = recycleDevicePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<RecycleDeviceEntity> recycleDeviceSuperWrapper = new QueryWrapper<>();
recycleDeviceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeviceSuperWrapper,RecycleDeviceEntity.class,queryJson,"0"));
int recycleDeviceNum1 = recycleDeviceSuperWrapper.getExpression().getNormal().size();
if (recycleDeviceNum1>0){
List<String> recycleDeviceList =this.list(recycleDeviceSuperWrapper).stream().map(RecycleDeviceEntity::getId).collect(Collectors.toList());
allSuperList.addAll(recycleDeviceList);
intersectionSuperList.add(recycleDeviceList);
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<RecycleDeviceEntity> recycleDeviceSuperWrapper = new QueryWrapper<>();
recycleDeviceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(recycleDeviceSuperWrapper,RecycleDeviceEntity.class,ruleJson,"0"));
int recycleDeviceNum1 = recycleDeviceSuperWrapper.getExpression().getNormal().size();
if (recycleDeviceNum1>0){
List<String> recycleDeviceList =this.list(recycleDeviceSuperWrapper).stream().map(RecycleDeviceEntity::getId).collect(Collectors.toList());
allRuleList.addAll(recycleDeviceList);
intersectionRuleList.add(recycleDeviceList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = false;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object recycleDeviceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeviceQueryWrapper,RecycleDeviceEntity.class,recycleDevicePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(recycleDeviceObj)){
return new ArrayList<>();
} else {
recycleDeviceQueryWrapper = (QueryWrapper<RecycleDeviceEntity>)recycleDeviceObj;
if( recycleDeviceQueryWrapper.getExpression().getNormal().size()>0){
recycleDeviceNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object recycleDeviceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(recycleDeviceQueryWrapper,RecycleDeviceEntity.class,recycleDevicePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(recycleDeviceObj)){
return new ArrayList<>();
} else {
recycleDeviceQueryWrapper = (QueryWrapper<RecycleDeviceEntity>)recycleDeviceObj;
if( recycleDeviceQueryWrapper.getExpression().getNormal().size()>0){
recycleDeviceNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(recycleDevicePagination.getDeviceCode())){
recycleDeviceNum++;
String value = recycleDevicePagination.getDeviceCode() instanceof List ?
JsonUtil.getObjectToString(recycleDevicePagination.getDeviceCode()) :
String.valueOf(recycleDevicePagination.getDeviceCode());
recycleDeviceQueryWrapper.lambda().like(RecycleDeviceEntity::getDeviceCode,value);
}
if(ObjectUtil.isNotEmpty(recycleDevicePagination.getDeviceName())){
recycleDeviceNum++;
String value = recycleDevicePagination.getDeviceName() instanceof List ?
JsonUtil.getObjectToString(recycleDevicePagination.getDeviceName()) :
String.valueOf(recycleDevicePagination.getDeviceName());
recycleDeviceQueryWrapper.lambda().like(RecycleDeviceEntity::getDeviceName,value);
}
if(ObjectUtil.isNotEmpty(recycleDevicePagination.getUseStatus())){
recycleDeviceNum++;
recycleDeviceQueryWrapper.lambda().eq(RecycleDeviceEntity::getUseStatus,recycleDevicePagination.getUseStatus());
}
if(ObjectUtil.isNotEmpty(recycleDevicePagination.getStatus())){
recycleDeviceNum++;
recycleDeviceQueryWrapper.lambda().eq(RecycleDeviceEntity::getStatus,recycleDevicePagination.getStatus());
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
recycleDeviceQueryWrapper.lambda().in(RecycleDeviceEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
recycleDeviceQueryWrapper.lambda().and(t->t.in(RecycleDeviceEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
recycleDeviceQueryWrapper.lambda().and(t->t.in(RecycleDeviceEntity::getId, finalAllRuleIDlist));
}
//排序
if(StringUtil.isEmpty(recycleDevicePagination.getSidx())){
recycleDeviceQueryWrapper.lambda().orderByDesc(RecycleDeviceEntity::getId);
}else{
try {
String sidx = recycleDevicePagination.getSidx();
String[] strs= sidx.split("_name");
RecycleDeviceEntity recycleDeviceEntity = new RecycleDeviceEntity();
Field declaredField = recycleDeviceEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
recycleDeviceQueryWrapper="asc".equals(recycleDevicePagination.getSort().toLowerCase())?recycleDeviceQueryWrapper.orderByAsc(value):recycleDeviceQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<RecycleDeviceEntity> page=new Page<>(recycleDevicePagination.getCurrentPage(), recycleDevicePagination.getPageSize());
IPage<RecycleDeviceEntity> userIPage=this.page(page, recycleDeviceQueryWrapper);
return recycleDevicePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<RecycleDeviceEntity> list = new ArrayList();
return recycleDevicePagination.setData(list, list.size());
}
}else{
return this.list(recycleDeviceQueryWrapper);
}
}
@Override
public RecycleDeviceEntity getInfo(String id){
QueryWrapper<RecycleDeviceEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(RecycleDeviceEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(RecycleDeviceEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, RecycleDeviceEntity entity){
return this.updateById(entity);
}
@Override
public void delete(RecycleDeviceEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(RecycleDeviceForm 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.getDeviceName())){
return "设备名称不能为空";
}
if(StringUtil.isEmpty(form.getAddress())){
return "地址不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param recycleDeviceForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(RecycleDeviceForm recycleDeviceForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
recycleDeviceForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(RecycleDeviceConstant.getFormData(),recycleDeviceForm),RecycleDeviceForm.class);
RecycleDeviceEntity entity = JsonUtil.getJsonToBean(recycleDeviceForm, RecycleDeviceEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setDeviceCode(generaterSwapUtil.getBillNumber("deviceCode", false));
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
entity.setId(mainId);
}else{
entity.setDeviceCode(generaterSwapUtil.getBillNumber("deviceCode", false));
entity.setLastModifyUserId(null);
entity.setLastModifyTime(null);
entity.setOrganizeJsonId(generaterSwapUtil.getCurrentOrgIds(userInfo.getOrganizeId(),"all"));
}
this.saveOrUpdate(entity);
}
}

@ -11,7 +11,7 @@ import jnpf.permission.entity.UserEntity;
import jnpf.service.*; import jnpf.service.*;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.util.*; import jnpf.util.*;
import jnpf.model.nxrecycledevice.*; import jnpf.model.recycledevice.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -30,17 +30,17 @@ import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* NxRecycleDevice *
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-05-24 * @ 2024-05-29
*/ */
@Slf4j @Slf4j
@RestController @RestController
@Tag(name = "NxRecycleDevice" , description = "scm") @Tag(name = "投递柜设备" , description = "scm")
@RequestMapping("/api/scm/NxRecycleDevice") @RequestMapping("/api/scm/RecycleDevice")
public class NxRecycleDeviceController { public class RecycleDeviceController {
@Autowired @Autowired
private GeneraterSwapUtil generaterSwapUtil; private GeneraterSwapUtil generaterSwapUtil;
@ -49,54 +49,55 @@ public class NxRecycleDeviceController {
private UserProvider userProvider; private UserProvider userProvider;
@Autowired @Autowired
private NxRecycleDeviceService nxRecycleDeviceService; private RecycleDeviceService recycleDeviceService;
/** /**
* *
* *
* @param nxRecycleDevicePagination * @param recycleDevicePagination
* @return * @return
*/ */
@Operation(summary = "获取列表") @Operation(summary = "获取列表")
@PostMapping("/getList") @PostMapping("/getList")
public ActionResult list(@RequestBody NxRecycleDevicePagination nxRecycleDevicePagination)throws IOException{ public ActionResult list(@RequestBody RecycleDevicePagination recycleDevicePagination)throws IOException{
List<NxRecycleDeviceEntity> list= nxRecycleDeviceService.getList(nxRecycleDevicePagination); List<RecycleDeviceEntity> list= recycleDeviceService.getList(recycleDevicePagination);
List<Map<String, Object>> realList=new ArrayList<>(); List<Map<String, Object>> realList=new ArrayList<>();
for (NxRecycleDeviceEntity entity : list) { for (RecycleDeviceEntity entity : list) {
Map<String, Object> nxRecycleDeviceMap=JsonUtil.entityToMap(entity); Map<String, Object> recycleDeviceMap=JsonUtil.entityToMap(entity);
nxRecycleDeviceMap.put("id", nxRecycleDeviceMap.get("id")); recycleDeviceMap.put("id", recycleDeviceMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
realList.add(nxRecycleDeviceMap); realList.add(recycleDeviceMap);
} }
//数据转换 //数据转换
realList = generaterSwapUtil.swapDataList(realList, NxRecycleDeviceConstant.getFormData(), NxRecycleDeviceConstant.getColumnData(), nxRecycleDevicePagination.getModuleId(),false); realList = generaterSwapUtil.swapDataList(realList, RecycleDeviceConstant.getFormData(), RecycleDeviceConstant.getColumnData(), recycleDevicePagination.getModuleId(),false);
//返回对象 //返回对象
PageListVO vo = new PageListVO(); PageListVO vo = new PageListVO();
vo.setList(realList); vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(nxRecycleDevicePagination, PaginationVO.class); PaginationVO page = JsonUtil.getJsonToBean(recycleDevicePagination, PaginationVO.class);
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
* @param nxRecycleDeviceForm * @param recycleDeviceForm
* @return * @return
*/ */
@PostMapping() @PostMapping()
@Operation(summary = "创建") @Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid NxRecycleDeviceForm nxRecycleDeviceForm) { public ActionResult create(@RequestBody @Valid RecycleDeviceForm recycleDeviceForm) {
String b = nxRecycleDeviceService.checkForm(nxRecycleDeviceForm,0); String b = recycleDeviceService.checkForm(recycleDeviceForm,0);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b ); return ActionResult.fail(b );
} }
try{ try{
nxRecycleDeviceService.saveOrUpdate(nxRecycleDeviceForm, null ,true); recycleDeviceService.saveOrUpdate(recycleDeviceForm, null ,true);
}catch(Exception e){ }catch(Exception e){
e.printStackTrace();
return ActionResult.fail("新增数据失败"); return ActionResult.fail("新增数据失败");
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
@ -104,25 +105,26 @@ public class NxRecycleDeviceController {
/** /**
* *
* @param id * @param id
* @param nxRecycleDeviceForm * @param recycleDeviceForm
* @return * @return
*/ */
@PutMapping("/{id}") @PutMapping("/{id}")
@Operation(summary = "更新") @Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid NxRecycleDeviceForm nxRecycleDeviceForm, public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid RecycleDeviceForm recycleDeviceForm,
@RequestParam(value = "isImport", required = false) boolean isImport){ @RequestParam(value = "isImport", required = false) boolean isImport){
nxRecycleDeviceForm.setId(id); recycleDeviceForm.setId(id);
if (!isImport) { if (!isImport) {
String b = nxRecycleDeviceService.checkForm(nxRecycleDeviceForm,1); String b = recycleDeviceService.checkForm(recycleDeviceForm,1);
if (StringUtil.isNotEmpty(b)){ if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b ); return ActionResult.fail(b );
} }
} }
NxRecycleDeviceEntity entity= nxRecycleDeviceService.getInfo(id); RecycleDeviceEntity entity= recycleDeviceService.getInfo(id);
if(entity!=null){ if(entity!=null){
try{ try{
nxRecycleDeviceService.saveOrUpdate(nxRecycleDeviceForm,id,false); recycleDeviceService.saveOrUpdate(recycleDeviceForm,id,false);
}catch(Exception e){ }catch(Exception e){
e.printStackTrace();
return ActionResult.fail("修改数据失败"); return ActionResult.fail("修改数据失败");
} }
return ActionResult.success("更新成功"); return ActionResult.success("更新成功");
@ -139,10 +141,10 @@ public class NxRecycleDeviceController {
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@Transactional @Transactional
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id){
NxRecycleDeviceEntity entity= nxRecycleDeviceService.getInfo(id); RecycleDeviceEntity entity= recycleDeviceService.getInfo(id);
if(entity!=null){ if(entity!=null){
//主表数据删除 //主表数据删除
nxRecycleDeviceService.delete(entity); recycleDeviceService.delete(entity);
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
@ -155,16 +157,16 @@ public class NxRecycleDeviceController {
@Operation(summary = "表单信息(详情页)") @Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}") @GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){ public ActionResult detailInfo(@PathVariable("id") String id){
NxRecycleDeviceEntity entity= nxRecycleDeviceService.getInfo(id); RecycleDeviceEntity entity= recycleDeviceService.getInfo(id);
if(entity==null){ if(entity==null){
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> nxRecycleDeviceMap=JsonUtil.entityToMap(entity); Map<String, Object> recycleDeviceMap=JsonUtil.entityToMap(entity);
nxRecycleDeviceMap.put("id", nxRecycleDeviceMap.get("id")); recycleDeviceMap.put("id", recycleDeviceMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
nxRecycleDeviceMap = generaterSwapUtil.swapDataDetail(nxRecycleDeviceMap,NxRecycleDeviceConstant.getFormData(),"563701730794023749",false); recycleDeviceMap = generaterSwapUtil.swapDataDetail(recycleDeviceMap,RecycleDeviceConstant.getFormData(),"563701730794023749",false);
return ActionResult.success(nxRecycleDeviceMap); return ActionResult.success(recycleDeviceMap);
} }
/** /**
* () * ()
@ -175,16 +177,16 @@ public class NxRecycleDeviceController {
@Operation(summary = "信息") @Operation(summary = "信息")
@GetMapping("/{id}") @GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){ public ActionResult info(@PathVariable("id") String id){
NxRecycleDeviceEntity entity= nxRecycleDeviceService.getInfo(id); RecycleDeviceEntity entity= recycleDeviceService.getInfo(id);
if(entity==null){ if(entity==null){
return ActionResult.fail("表单数据不存在!"); return ActionResult.fail("表单数据不存在!");
} }
Map<String, Object> nxRecycleDeviceMap=JsonUtil.entityToMap(entity); Map<String, Object> recycleDeviceMap=JsonUtil.entityToMap(entity);
nxRecycleDeviceMap.put("id", nxRecycleDeviceMap.get("id")); recycleDeviceMap.put("id", recycleDeviceMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
nxRecycleDeviceMap = generaterSwapUtil.swapDataForm(nxRecycleDeviceMap,NxRecycleDeviceConstant.getFormData(),NxRecycleDeviceConstant.TABLEFIELDKEY,NxRecycleDeviceConstant.TABLERENAMES); recycleDeviceMap = generaterSwapUtil.swapDataForm(recycleDeviceMap,RecycleDeviceConstant.getFormData(),RecycleDeviceConstant.TABLEFIELDKEY,RecycleDeviceConstant.TABLERENAMES);
return ActionResult.success(nxRecycleDeviceMap); return ActionResult.success(recycleDeviceMap);
} }
} }

@ -9,21 +9,21 @@ import java.util.Date;
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-05-24 * @ 2024-05-29
*/ */
@Data @Data
@TableName("nx_recycle_device") @TableName("nx_recycle_device")
public class NxRecycleDeviceEntity { public class RecycleDeviceEntity {
@TableId(value ="ID" ) @TableId(value ="ID" )
private String id; private String id;
@TableField(value = "DEVICE_CODE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "DEVICE_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String deviceCode; private String deviceCode;
@TableField(value = "DEVICE_NAME" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "DEVICE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private Integer deviceName; private String deviceName;
@TableField(value = "CITY" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "CITY" , updateStrategy = FieldStrategy.IGNORED)
private Integer city; private String city;
@TableField(value = "ADDRESS" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "ADDRESS" , updateStrategy = FieldStrategy.IGNORED)
private Integer address; private String address;
@TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED)
private Integer status; private Integer status;
@TableField(value = "USE_STATUS" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "USE_STATUS" , updateStrategy = FieldStrategy.IGNORED)
@ -36,9 +36,9 @@ public class NxRecycleDeviceEntity {
private String beLongStationCode; private String beLongStationCode;
@TableField(value = "BE_LONG_COMPANY_ID" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "BE_LONG_COMPANY_ID" , updateStrategy = FieldStrategy.IGNORED)
private String beLongCompanyId; private String beLongCompanyId;
@TableField("LATITUDE") @TableField(value = "LATITUDE" , updateStrategy = FieldStrategy.IGNORED)
private String latitude; private String latitude;
@TableField("LONGITUDE") @TableField(value = "LONGITUDE" , updateStrategy = FieldStrategy.IGNORED)
private String longitude; private String longitude;
@TableField("F_CREATOR_USER_ID") @TableField("F_CREATOR_USER_ID")
private String creatorUserId; private String creatorUserId;

@ -1,4 +1,4 @@
package jnpf.model.nxrecycledevice; package jnpf.model.recycledevice;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@ -6,14 +6,14 @@ import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* NxRecycleDevice *
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-05-24 * @ 2024-05-29
*/ */
@Data @Data
public class NxRecycleDeviceForm { public class RecycleDeviceForm {
/** 主键 */ /** 主键 */
private String id; private String id;
@ -29,22 +29,37 @@ public class NxRecycleDeviceForm {
/** 地址 **/ /** 地址 **/
@JsonProperty("address") @JsonProperty("address")
private String address; private String address;
/** 投用状态 **/
@JsonProperty("useStatus")
private String useStatus;
/** 设备状态 **/ /** 设备状态 **/
@JsonProperty("status") @JsonProperty("status")
private String status; private String status;
/** 启用 **/ /** 分配商户 **/
@JsonProperty("useStatus") @JsonProperty("beLongCompanyId")
private String useStatus; private String beLongCompanyId;
/** 设备通信ip地址 **/ /** 分配回收站 **/
@JsonProperty("beLongStationCode")
private String beLongStationCode;
/** 设备IP **/
@JsonProperty("ipAddress") @JsonProperty("ipAddress")
private String ipAddress; private String ipAddress;
/** 设备总重 **/ /** 设备总重 **/
@JsonProperty("boxWeight") @JsonProperty("boxWeight")
private String boxWeight; private String boxWeight;
/** 所属回收站 **/ /** 纬度 **/
@JsonProperty("beLongStationCode") @JsonProperty("latitude")
private String beLongStationCode; private String latitude;
/** 所属商户 **/ /** 经度 **/
@JsonProperty("beLongCompanyId") @JsonProperty("longitude")
private String beLongCompanyId; private String longitude;
/** 修改用户 **/
@JsonProperty("lastModifyUserId")
private String lastModifyUserId;
/** 修改时间 **/
@JsonProperty("lastModifyTime")
private String lastModifyTime;
/** 所属组织 **/
@JsonProperty("organizeJsonId")
private Object organizeJsonId;
} }

@ -1,4 +1,4 @@
package jnpf.model.nxrecycledevice; package jnpf.model.recycledevice;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
@ -7,14 +7,14 @@ import java.util.List;
/** /**
* *
* NxRecycleDevice *
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-05-24 * @ 2024-05-29
*/ */
@Data @Data
public class NxRecycleDevicePagination extends Pagination { public class RecycleDevicePagination extends Pagination {
/** 查询key */ /** 查询key */
private String[] selectKey; private String[] selectKey;
/** json */ /** json */
@ -33,4 +33,10 @@ public class NxRecycleDevicePagination extends Pagination {
/** 设备名称 */ /** 设备名称 */
@JsonProperty("deviceName") @JsonProperty("deviceName")
private Object deviceName; private Object deviceName;
/** 投用状态 */
@JsonProperty("useStatus")
private Object useStatus;
/** 设备状态 */
@JsonProperty("status")
private Object status;
} }

@ -1,153 +0,0 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" content="详情" />
<div class="options">
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" size="small" label-width="125px" label-position="right">
<template v-if="!loading">
<el-col :span="8">
<jnpf-form-tip-item label="设备编码" prop="deviceCode">
<p>{{ dataForm.deviceCode }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备名称" prop="deviceName">
<p>{{ dataForm.deviceName }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所在城市" prop="city">
<p>{{ dataForm.city }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="地址" prop="address">
<p>{{ dataForm.address }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备状态" prop="status">
<p>{{ dataForm.status }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="启用" prop="useStatus">
<p>{{ dataForm.useStatus }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备通信ip地址" prop="ipAddress">
<p>{{ dataForm.ipAddress }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备总重" prop="boxWeight">
<p>{{ dataForm.boxWeight }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所属回收站" prop="beLongStationCode">
<p>{{ dataForm.beLongStationCode }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所属商户" prop="beLongCompanyId">
<p>{{ dataForm.beLongCompanyId }}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail },
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id: '',
deviceCode: '',
deviceName: '',
city: [],
address: '',
status: "1",
useStatus: "1",
ipAddress: '',
boxWeight: '',
beLongStationCode: "",
beLongCompanyId: "",
},
statusOptions: [{ "fullName": "离线", "id": "0" }, { "fullName": "在线", "id": "1" }],
statusProps: { "label": "fullName", "value": "id" },
useStatusOptions: [{ "fullName": "关闭", "id": "0" }, { "fullName": "启用", "id": "1" }, { "fullName": "暂停服务", "id": "2" }],
useStatusProps: { "label": "fullName", "value": "id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() { },
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
},
goBack() {
this.$emit('refresh')
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/NxRecycleDevice/detail/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
}
})
},
},
}
</script>

File diff suppressed because one or more lines are too long

@ -1,527 +0,0 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{ '下一条' }}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)"
:loading="continueBtnLoading" :disabled='btnLoading'>
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"
:disabled='continueBtnLoading'>
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="125px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="8">
<jnpf-form-tip-item label="设备编码" prop="deviceCode">
<JnpfInput v-model="dataForm.deviceCode" @change="changeData('deviceCode', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备名称" prop="deviceName">
<JnpfInput v-model="dataForm.deviceName" @change="changeData('deviceName', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所在城市" prop="city">
<JnpfAreaSelect v-model="dataForm.city" @change="changeData('city', -1)"
placeholder="请选择" selectType="all" clearable :style='{ "width": "100%" }' :level="2">
</JnpfAreaSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="地址" prop="address">
<JnpfInput v-model="dataForm.address" @change="changeData('address', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备状态" prop="status">
<JnpfRadio v-model="dataForm.status" @change="changeData('status', -1)"
optionType="default" direction="horizontal" size="small" :options="statusOptions"
:props="statusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="启用" prop="useStatus">
<JnpfRadio v-model="dataForm.useStatus" @change="changeData('useStatus', -1)"
optionType="default" direction="horizontal" size="small" :options="useStatusOptions"
:props="useStatusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备通信ip地址" prop="ipAddress">
<JnpfInput v-model="dataForm.ipAddress" @change="changeData('ipAddress', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="设备总重" prop="boxWeight">
<JnpfInput v-model="dataForm.boxWeight" @change="changeData('boxWeight', -1)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所属回收站" prop="beLongStationCode">
<JnpfPopupSelect v-model="dataForm.beLongStationCode"
@change="changeData('beLongStationCode', -1)" :rowIndex="null" :formData="dataForm"
:templateJson="interfaceRes.beLongStationCode" placeholder="请选择"
propsValue="station_code" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='station_name' field='beLongStationCode'
interfaceId="563705984451619653" :pageSize="20"
:columnOptions="beLongStationCodecolumnOptions" clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="所属商户" prop="beLongCompanyId">
<JnpfPopupSelect v-model="dataForm.beLongCompanyId"
@change="changeData('beLongCompanyId', -1)" :rowIndex="null" :formData="dataForm"
:templateJson="interfaceRes.beLongCompanyId" placeholder="请选择" propsValue="f_id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='f_full_name'
field='beLongCompanyId' interfaceId="563706688754953029" :pageSize="20"
:columnOptions="beLongCompanyIdcolumnOptions" clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</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>
</div>
</transition>
</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: {
deviceCode: undefined,
deviceName: undefined,
city: [],
address: undefined,
status: "1",
useStatus: "1",
ipAddress: undefined,
boxWeight: undefined,
beLongStationCode: undefined,
beLongCompanyId: undefined,
},
tableRequiredData: {},
dataRule:
{
deviceCode: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
deviceName: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
city: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
address: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
},
statusOptions: [{ "fullName": "离线", "id": "0" }, { "fullName": "在线", "id": "1" }],
statusProps: { "label": "fullName", "value": "id" },
useStatusOptions: [{ "fullName": "关闭", "id": "0" }, { "fullName": "启用", "id": "1" }, { "fullName": "暂停服务", "id": "2" }],
useStatusProps: { "label": "fullName", "value": "id" },
beLongStationCodecolumnOptions: [{ "label": "回收站编号", "value": "station_code" }, { "label": "回收站名称", "value": "station_name" },],
beLongCompanyIdcolumnOptions: [{ "label": "商户ID", "value": "f_id" }, { "label": "商户名称", "value": "f_full_name" },],
childIndex: -1,
isEdit: false,
interfaceRes: {
deviceCode: [],
deviceName: [],
city: [],
address: [],
status: [],
useStatus: [],
ipAddress: [],
boxWeight: [],
beLongStationCode: [],
beLongCompanyId: [],
},
}
},
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/NxRecycleDevice/' + 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() {
},
goBack() {
this.$emit('refresh')
},
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/NxRecycleDevice/' + 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/NxRecycleDevice',
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/NxRecycleDevice/' + 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>

File diff suppressed because one or more lines are too long

@ -0,0 +1,175 @@
<template>
<el-dialog title="详情"
: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" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label="设备编码"
prop="deviceCode" >
<p>{{dataForm.deviceCode}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="设备名称"
prop="deviceName" tip-label="设备名称" >
<p>{{dataForm.deviceName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="所在城市"
prop="city" >
<p>{{dataForm.city}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="地址"
prop="address" >
<p>{{dataForm.address}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="投用状态"
prop="useStatus" >
<p>{{ dataForm.useStatus }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="设备状态"
prop="status" >
<p>{{ dataForm.status }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="分配商户"
prop="beLongCompanyId" tip-label="绑定商户" >
<p>{{dataForm.beLongCompanyId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="分配回收站"
prop="beLongStationCode" tip-label="绑定回收站" >
<p>{{dataForm.beLongStationCode}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="设备总重"
prop="boxWeight" >
<p>{{dataForm.boxWeight}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="修改用户"
prop="lastModifyUserId" >
<p>{{dataForm.lastModifyUserId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="修改时间"
prop="lastModifyTime" >
<p>{{dataForm.lastModifyTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="所属组织"
prop="organizeJsonId" >
<p>{{dataForm.organizeJsonId}}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
deviceCode : '',
deviceName : '',
city : [],
address : '',
useStatus : "1",
status : "1",
beLongCompanyId : "",
beLongStationCode : "",
ipAddress : '',
boxWeight : '',
latitude : '',
longitude : '',
lastModifyUserId : "",
lastModifyTime : "",
organizeJsonId : "",
},
useStatusOptions:[{"fullName":"启用","id":"1"},{"fullName":"暂停服务","id":"2"},{"fullName":"关闭","id":"0"}],
useStatusProps:{"label":"fullName","value":"id" },
statusOptions:[{"fullName":"离线","id":"0"},{"fullName":"在线","id":"1"}],
statusProps:{"label":"fullName","value":"id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/RecycleDevice/detail/'+this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
}
})
},
},
}
</script>

File diff suppressed because one or more lines are too long

@ -0,0 +1,532 @@
<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="24" >
<jnpf-form-tip-item
label="设备编码" prop="deviceCode" >
<JnpfInput v-model="dataForm.deviceCode" @change="changeData('deviceCode',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="设备名称" tipLabel="设备名称" prop="deviceName" >
<JnpfInput v-model="dataForm.deviceName" @change="changeData('deviceName',-1)"
placeholder="设备名称" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="所在城市" prop="city" >
<JnpfAreaSelect v-model="dataForm.city" @change="changeData('city',-1)"
placeholder="请选择" selectType="all" clearable :style='{"width":"100%"}' :level="2" >
</JnpfAreaSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="地址" prop="address" >
<JnpfInput v-model="dataForm.address" @change="changeData('address',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="投用状态" prop="useStatus" >
<JnpfRadio v-model="dataForm.useStatus" @change="changeData('useStatus',-1)"
optionType="default" direction="horizontal" size="small" :options="useStatusOptions" :props="useStatusProps" >
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="设备状态" prop="status" >
<JnpfRadio v-model="dataForm.status" @change="changeData('status',-1)"
optionType="default" direction="horizontal" size="small" :options="statusOptions" :props="statusProps" >
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="分配商户" tipLabel="绑定商户" prop="beLongCompanyId" >
<JnpfPopupSelect v-model="dataForm.beLongCompanyId" @change="changeData('beLongCompanyId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.beLongCompanyId" placeholder="请选择商户" propsValue="f_id" popupWidth="800px" popupTitle="绑定商户" popupType="dialog" relationField='f_full_name' field='beLongCompanyId' interfaceId="563706688754953029" :pageSize="20" :columnOptions="beLongCompanyIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="分配回收站" tipLabel="绑定回收站" prop="beLongStationCode" >
<JnpfPopupSelect v-model="dataForm.beLongStationCode" @change="changeData('beLongStationCode',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.beLongStationCode" placeholder="请选择回收站" propsValue="station_code" popupWidth="800px" popupTitle="绑定回收站" popupType="dialog" relationField='station_name' field='beLongStationCode' interfaceId="563705984451619653" :pageSize="20" :columnOptions="beLongStationCodecolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="设备总重" prop="boxWeight" >
<JnpfInput v-model="dataForm.boxWeight" @change="changeData('boxWeight',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="修改用户" prop="lastModifyUserId" >
<JnpfInput v-model="dataForm.lastModifyUserId" @change="changeData('lastModifyUserId',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="修改时间" prop="lastModifyTime" >
<JnpfInput v-model="dataForm.lastModifyTime" @change="changeData('lastModifyTime',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="所属组织" prop="organizeJsonId" >
<JnpfOpenData v-model="dataForm.organizeJsonId" @change="changeData('organizeJsonId',-1)"
placeholder="系统自动生成" readonly :style='{"width":"100%"}' type="currOrganize" showLevel="all" >
</JnpfOpenData>
</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>
<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: {
deviceCode : undefined,
deviceName : undefined,
city : [],
address : undefined,
useStatus : "1",
status : "1",
beLongCompanyId : undefined,
beLongStationCode : undefined,
ipAddress : undefined,
boxWeight : undefined,
latitude : undefined,
longitude : undefined,
lastModifyUserId : undefined,
lastModifyTime : undefined,
organizeJsonId : undefined,
},
tableRequiredData: {},
dataRule:
{
deviceName: [
{
required: true,
message: '设备名称',
trigger: 'blur'
},
],
city: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
address: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
},
useStatusOptions:[{"fullName":"启用","id":"1"},{"fullName":"暂停服务","id":"2"},{"fullName":"关闭","id":"0"}],
useStatusProps:{"label":"fullName","value":"id" },
statusOptions:[{"fullName":"离线","id":"0"},{"fullName":"在线","id":"1"}],
statusProps:{"label":"fullName","value":"id" },
beLongCompanyIdcolumnOptions:[ {"label":"商户ID","value":"f_id"}, {"label":"商户名称","value":"f_full_name"},],
beLongStationCodecolumnOptions:[ {"label":"回收站编号","value":"station_code"}, {"label":"回收站名称","value":"station_name"},],
childIndex:-1,
isEdit:false,
interfaceRes: {
deviceCode:[] ,
deviceName:[] ,
city:[] ,
address:[] ,
useStatus:[] ,
status:[] ,
beLongCompanyId:[] ,
beLongStationCode:[] ,
ipAddress:[] ,
boxWeight:[] ,
latitude:[] ,
longitude:[] ,
lastModifyUserId:[] ,
lastModifyTime:[] ,
organizeJsonId:[] ,
},
}
},
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/RecycleDevice/'+ 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/RecycleDevice/'+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/RecycleDevice',
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/RecycleDevice/'+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>

@ -20,10 +20,34 @@
<el-input v-model="query.deviceName" placeholder="请输入" clearable> </el-input> <el-input v-model="query.deviceName" placeholder="请输入" clearable> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<el-form-item label="投用状态">
<JnpfSelect v-model="query.useStatus" placeholder="请选择" clearable
:options="useStatusOptions"
:props="useStatusProps" >
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="设备状态">
<JnpfSelect v-model="query.status" placeholder="请选择" clearable
:options="statusOptions"
:props="statusProps" >
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<el-col :span="6"> <el-col :span="6">
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button> <el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button> <el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
<el-button type="text" icon="el-icon-arrow-down" @click="showAll=true" v-if="!showAll">
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll=false" v-else>
收起
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-form> </el-form>
@ -57,16 +81,6 @@
<el-table-column <el-table-column
prop="deviceName" prop="deviceName"
label="设备名称" align="left" label="设备名称" align="left"
>
</el-table-column>
<el-table-column
prop="city"
label="所在城市" align="left"
>
</el-table-column>
<el-table-column
prop="address"
label="地址" align="left"
> >
</el-table-column> </el-table-column>
<el-table-column label="设备状态" prop="status" algin="left" <el-table-column label="设备状态" prop="status" algin="left"
@ -75,15 +89,35 @@
{{ scope.row.status}} {{ scope.row.status}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="启用" prop="use" algin="left" <el-table-column label="投用状态" prop="useStatus" algin="left"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.use}} {{ scope.row.useStatus}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
prop="beLongCompanyId"
label="分配商户" align="left"
>
</el-table-column>
<el-table-column
prop="beLongStationCode"
label="分配回收站" align="left"
>
</el-table-column>
<el-table-column
prop="city"
label="所在城市" align="left"
>
</el-table-column>
<el-table-column
prop="address"
label="地址" align="left"
>
</el-table-column>
<el-table-column <el-table-column
prop="ipAddress" prop="ipAddress"
label="设备通信ip地址" align="left" label="设备IP" align="left"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -92,13 +126,13 @@
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="beLongStationCode" prop="lastModifyUserId"
label="所属回收站" align="left" label="修改用户" align="left"
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="beLongCompanyId" prop="lastModifyTime"
label="所属商户" align="left" label="修改时间" align="left"
> >
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"
@ -169,6 +203,7 @@
exportList:[], exportList:[],
columnList, columnList,
showAll: false,
superQueryVisible: false, superQueryVisible: false,
superQueryJson, superQueryJson,
uploadBoxVisible: false, uploadBoxVisible: false,
@ -176,6 +211,8 @@
query: { query: {
deviceCode:undefined, deviceCode:undefined,
deviceName:undefined, deviceName:undefined,
useStatus:undefined,
status:undefined,
}, },
treeProps: { treeProps: {
children: 'children', children: 'children',
@ -199,13 +236,13 @@
flowListVisible: false, flowListVisible: false,
flowList: [], flowList: [],
exportBoxVisible: false, exportBoxVisible: false,
statusOptions:[{"fullName":"离线","id":"0"},{"fullName":"在线","id":"1"}], useStatusOptions:[{"fullName":"启用","id":"1"},{"fullName":"暂停服务","id":"2"},{"fullName":"关闭","id":"0"}],
statusProps:{"label":"fullName","value":"id" },
useStatusOptions:[{"fullName":"关闭","id":"0"},{"fullName":"启用","id":"1"},{"fullName":"暂停服务","id":"2"}],
useStatusProps:{"label":"fullName","value":"id" }, useStatusProps:{"label":"fullName","value":"id" },
statusOptions:[{"fullName":"离线","id":"0"},{"fullName":"在线","id":"1"}],
statusProps:{"label":"fullName","value":"id" },
interfaceRes: { interfaceRes: {
beLongStationCode:[] ,
beLongCompanyId:[] , beLongCompanyId:[] ,
beLongStationCode:[] ,
}, },
} }
}, },
@ -398,7 +435,7 @@
type:1, type:1,
}; };
request({ request({
url: `/api/scm/NxRecycleDevice/getList`, url: `/api/scm/RecycleDevice/getList`,
method: 'post', method: 'post',
data: _query data: _query
}).then(res => { }).then(res => {
@ -416,7 +453,7 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
request({ request({
url: `/api/scm/NxRecycleDevice/${id}`, url: `/api/scm/RecycleDevice/${id}`,
method: 'DELETE' method: 'DELETE'
}).then(res => { }).then(res => {
this.$message({ this.$message({
@ -433,7 +470,7 @@
handelUpload(){ handelUpload(){
this.uploadBoxVisible = true this.uploadBoxVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.UploadBox.init("","scm/NxRecycleDevice") this.$refs.UploadBox.init("","scm/RecycleDevice")
}) })
}, },
openSuperQuery() { openSuperQuery() {
@ -463,7 +500,7 @@
download(data) { download(data) {
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId} let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
request({ request({
url: `/api/scm/NxRecycleDevice/Actions/Export`, url: `/api/scm/RecycleDevice/Actions/Export`,
method: 'post', method: 'post',
data: query data: query
}).then(res => { }).then(res => {

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