园区管理

master
vayne 3 months ago
parent 41df3aaf82
commit 144e7de92b

@ -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.RegionalMapper">
</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.SpatialMapper">
</mapper>

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

@ -0,0 +1,16 @@
package jnpf.mapper;
import jnpf.entity.ParkEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* park
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-15
*/
public interface ParkMapper extends BaseMapper<ParkEntity> {
}

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

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

@ -0,0 +1,314 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.AreaMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.area.*;
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;
/**
*
* area
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-16
*/
@Service
public class AreaServiceImpl extends ServiceImpl<AreaMapper, AreaEntity> implements AreaService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<AreaEntity> getList(AreaPagination areaPagination){
return getTypeList(areaPagination,areaPagination.getDataType());
}
/** 列表查询 */
@Override
public List<AreaEntity> getTypeList(AreaPagination areaPagination,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 ? AreaConstant.getAppColumnData() : AreaConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int areaNum =0;
QueryWrapper<AreaEntity> areaQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(areaPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = areaPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<AreaEntity> areaSuperWrapper = new QueryWrapper<>();
areaSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(areaSuperWrapper,AreaEntity.class,queryJson,"0"));
int areaNum1 = areaSuperWrapper.getExpression().getNormal().size();
if (areaNum1>0){
List<String> areaList =this.list(areaSuperWrapper).stream().map(AreaEntity::getId).collect(Collectors.toList());
allSuperList.addAll(areaList);
intersectionSuperList.add(areaList);
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<AreaEntity> areaSuperWrapper = new QueryWrapper<>();
areaSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(areaSuperWrapper,AreaEntity.class,ruleJson,"0"));
int areaNum1 = areaSuperWrapper.getExpression().getNormal().size();
if (areaNum1>0){
List<String> areaList =this.list(areaSuperWrapper).stream().map(AreaEntity::getId).collect(Collectors.toList());
allRuleList.addAll(areaList);
intersectionRuleList.add(areaList);
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 areaObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(areaQueryWrapper,AreaEntity.class,areaPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(areaObj)){
return new ArrayList<>();
} else {
areaQueryWrapper = (QueryWrapper<AreaEntity>)areaObj;
if( areaQueryWrapper.getExpression().getNormal().size()>0){
areaNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object areaObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(areaQueryWrapper,AreaEntity.class,areaPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(areaObj)){
return new ArrayList<>();
} else {
areaQueryWrapper = (QueryWrapper<AreaEntity>)areaObj;
if( areaQueryWrapper.getExpression().getNormal().size()>0){
areaNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(areaPagination.getName())){
areaNum++;
String value = areaPagination.getName() instanceof List ?
JsonUtil.getObjectToString(areaPagination.getName()) :
String.valueOf(areaPagination.getName());
areaQueryWrapper.lambda().like(AreaEntity::getName,value);
}
if(ObjectUtil.isNotEmpty(areaPagination.getPid())){
areaNum++;
String value = areaPagination.getPid() instanceof List ?
JsonUtil.getObjectToString(areaPagination.getPid()) :
String.valueOf(areaPagination.getPid());
areaQueryWrapper.lambda().like(AreaEntity::getPid,value);
}
}
if(!isPc){
if(ObjectUtil.isNotEmpty(areaPagination.getPid())){
areaNum++;
String value = areaPagination.getPid() instanceof List ?
JsonUtil.getObjectToString(areaPagination.getPid()) :
String.valueOf(areaPagination.getPid());
areaQueryWrapper.lambda().like(AreaEntity::getPid,value);
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
areaQueryWrapper.lambda().in(AreaEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
areaQueryWrapper.lambda().and(t->t.in(AreaEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
areaQueryWrapper.lambda().and(t->t.in(AreaEntity::getId, finalAllRuleIDlist));
}
//假删除标志
areaQueryWrapper.lambda().isNull(AreaEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(areaPagination.getSidx())){
areaQueryWrapper.lambda().orderByDesc(AreaEntity::getId);
}else{
try {
String sidx = areaPagination.getSidx();
String[] strs= sidx.split("_name");
AreaEntity areaEntity = new AreaEntity();
Field declaredField = areaEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
areaQueryWrapper="asc".equals(areaPagination.getSort().toLowerCase())?areaQueryWrapper.orderByAsc(value):areaQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<AreaEntity> page=new Page<>(areaPagination.getCurrentPage(), areaPagination.getPageSize());
IPage<AreaEntity> userIPage=this.page(page, areaQueryWrapper);
return areaPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<AreaEntity> list = new ArrayList();
return areaPagination.setData(list, list.size());
}
}else{
return this.list(areaQueryWrapper);
}
}
@Override
public AreaEntity getInfo(String id){
QueryWrapper<AreaEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(AreaEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(AreaEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, AreaEntity entity){
return this.updateById(entity);
}
@Override
public void delete(AreaEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(AreaForm 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.getPid())){
return "园区名称不能为空";
}
if(StringUtil.isEmpty(form.getCode())){
return "区域编码不能为空";
}
if(StringUtil.isNotEmpty(form.getCode())){
form.setCode(form.getCode().trim());
QueryWrapper<AreaEntity> codeWrapper=new QueryWrapper<>();
codeWrapper.lambda().eq(AreaEntity::getCode,form.getCode());
//假删除标志
codeWrapper.lambda().isNull(AreaEntity::getDeleteMark);
if (isUp){
codeWrapper.lambda().ne(AreaEntity::getId, id);
}
if((int) this.count(codeWrapper)>0){
countRecover = "区域编码"+form.getCode()+"不能重复";
}
}
if(StringUtil.isEmpty(form.getName())){
return "区域名称不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param areaForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(AreaForm areaForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
areaForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(AreaConstant.getFormData(),areaForm),AreaForm.class);
AreaEntity entity = JsonUtil.getJsonToBean(areaForm, AreaEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
entity.setVersion(0);
}else{
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,295 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ParkMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.park.*;
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.apache.commons.lang3.StringUtils;
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;
/**
*
* park
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-15
*/
@Service
public class ParkServiceImpl extends ServiceImpl<ParkMapper, ParkEntity> implements ParkService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<ParkEntity> getList(ParkPagination parkPagination){
return getTypeList(parkPagination,parkPagination.getDataType());
}
/** 列表查询 */
@Override
public List<ParkEntity> getTypeList(ParkPagination parkPagination,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 ? ParkConstant.getAppColumnData() : ParkConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int parkNum =0;
QueryWrapper<ParkEntity> parkQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(parkPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = parkPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ParkEntity> parkSuperWrapper = new QueryWrapper<>();
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper,ParkEntity.class,queryJson,"0"));
int parkNum1 = parkSuperWrapper.getExpression().getNormal().size();
if (parkNum1>0){
List<String> parkList =this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
allSuperList.addAll(parkList);
intersectionSuperList.add(parkList);
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<ParkEntity> parkSuperWrapper = new QueryWrapper<>();
parkSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(parkSuperWrapper,ParkEntity.class,ruleJson,"0"));
int parkNum1 = parkSuperWrapper.getExpression().getNormal().size();
if (parkNum1>0){
List<String> parkList =this.list(parkSuperWrapper).stream().map(ParkEntity::getId).collect(Collectors.toList());
allRuleList.addAll(parkList);
intersectionRuleList.add(parkList);
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 parkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper,ParkEntity.class,parkPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkObj)){
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>)parkObj;
if( parkQueryWrapper.getExpression().getNormal().size()>0){
parkNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object parkObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(parkQueryWrapper,ParkEntity.class,parkPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(parkObj)){
return new ArrayList<>();
} else {
parkQueryWrapper = (QueryWrapper<ParkEntity>)parkObj;
if( parkQueryWrapper.getExpression().getNormal().size()>0){
parkNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(parkPagination.getName())){
parkNum++;
String value = parkPagination.getName() instanceof List ?
JsonUtil.getObjectToString(parkPagination.getName()) :
String.valueOf(parkPagination.getName());
parkQueryWrapper.lambda().like(ParkEntity::getName,value);
}
if(StringUtils.isNotEmpty(parkPagination.getType())){
parkNum++;
parkQueryWrapper.lambda().like(ParkEntity::getType,parkPagination.getType());
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
parkQueryWrapper.lambda().in(ParkEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
parkQueryWrapper.lambda().and(t->t.in(ParkEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
parkQueryWrapper.lambda().and(t->t.in(ParkEntity::getId, finalAllRuleIDlist));
}
//假删除标志
parkQueryWrapper.lambda().isNull(ParkEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(parkPagination.getSidx())){
parkQueryWrapper.lambda().orderByDesc(ParkEntity::getId);
}else{
try {
String sidx = parkPagination.getSidx();
String[] strs= sidx.split("_name");
ParkEntity parkEntity = new ParkEntity();
Field declaredField = parkEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
parkQueryWrapper="asc".equals(parkPagination.getSort().toLowerCase())?parkQueryWrapper.orderByAsc(value):parkQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ParkEntity> page=new Page<>(parkPagination.getCurrentPage(), parkPagination.getPageSize());
IPage<ParkEntity> userIPage=this.page(page, parkQueryWrapper);
return parkPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<ParkEntity> list = new ArrayList();
return parkPagination.setData(list, list.size());
}
}else{
return this.list(parkQueryWrapper);
}
}
@Override
public ParkEntity getInfo(String id){
QueryWrapper<ParkEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ParkEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(ParkEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, ParkEntity entity){
return this.updateById(entity);
}
@Override
public void delete(ParkEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(ParkForm 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.getCode())){
return "园区编码不能为空";
}
if(StringUtil.isNotEmpty(form.getCode())){
form.setCode(form.getCode().trim());
QueryWrapper<ParkEntity> codeWrapper=new QueryWrapper<>();
codeWrapper.lambda().eq(ParkEntity::getCode,form.getCode());
//假删除标志
codeWrapper.lambda().isNull(ParkEntity::getDeleteMark);
if (isUp){
codeWrapper.lambda().ne(ParkEntity::getId, id);
}
if((int) this.count(codeWrapper)>0){
countRecover = "园区编码"+form.getCode()+"不能重复";
}
}
if(StringUtil.isEmpty(form.getName())){
return "园区名称不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param parkForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(ParkForm parkForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
parkForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ParkConstant.getFormData(),parkForm),ParkForm.class);
ParkEntity entity = JsonUtil.getJsonToBean(parkForm, ParkEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setId(mainId);
entity.setVersion(0);
}else{
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,511 @@
package jnpf.controller;
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.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.area.*;
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.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import java.io.IOException;
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;
/**
* area
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Slf4j
@RestController
@Tag(name = "area" , description = "example")
@RequestMapping("/api/example/Area")
public class AreaRenameController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private AreaService areaService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param areaPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody AreaPagination areaPagination)throws IOException{
List<AreaEntity> list= areaService.getList(areaPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (AreaEntity entity : list) {
Map<String, Object> areaMap=JsonUtil.entityToMap(entity);
areaMap.put("id", areaMap.get("id"));
//副表数据
//子表数据
realList.add(areaMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, AreaConstant.getFormData(), AreaConstant.getColumnData(), areaPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(areaPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param areaForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid AreaForm areaForm) {
String b = areaService.checkForm(areaForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
areaService.saveOrUpdate(areaForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody AreaPagination areaPagination) throws IOException {
if (StringUtil.isEmpty(areaPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<AreaEntity> list= areaService.getList(areaPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (AreaEntity entity : list) {
Map<String, Object> areaMap=JsonUtil.entityToMap(entity);
areaMap.put("id", areaMap.get("id"));
//副表数据
//子表数据
realList.add(areaMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, AreaConstant.getFormData(), AreaConstant.getColumnData(), areaPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(areaPagination.getSelectKey())?areaPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "pid" :
entitys.add(new ExcelExportEntity("园区名称" ,"pid"));
break;
case "code" :
entitys.add(new ExcelExportEntity("区域编码" ,"code"));
break;
case "spaceNum" :
entitys.add(new ExcelExportEntity("空间数量" ,"spaceNum"));
break;
case "name" :
entitys.add(new ExcelExportEntity("区域名称" ,"name"));
break;
case "description" :
entitys.add(new ExcelExportEntity("区域描述" ,"description"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(AreaConstant.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("园区名称" ,"pid"));
entitys.add(new ExcelExportEntity("区域编码" ,"code"));
entitys.add(new ExcelExportEntity("空间数量" ,"spaceNum"));
entitys.add(new ExcelExportEntity("区域名称" ,"name"));
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(AreaConstant.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 = 1;
ImportParams params = new ImportParams();
params.setTitleRows(0);
params.setHeadRows(headerRowIndex);
params.setNeedVerify(true);
try {
List<AreaExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, AreaExcelVO.class, params);
// 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("pid","园区名称"));
columns.add(new ExcelImFieldModel("code","区域编码"));
columns.add(new ExcelImFieldModel("spaceNum","空间数量"));
columns.add(new ExcelImFieldModel("name","区域名称"));
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(AreaConstant.DBLINKID);
uniqueModel.setUpdate(Objects.equals("2", "2"));
ExcelImportModel excelImportModel = generaterSwapUtil.importData(AreaConstant.getFormData(),listData,uniqueModel,
AreaConstant.TABLEFIELDKEY,AreaConstant.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,AreaForm.class), true);
}else {
create( JsonUtil.getJsonToBean(result,AreaForm.class));
}
}
return ActionResult.success(excelImportModel);
}
/**
*
*
* @return
*/
@Operation(summary = "导出异常报告")
@PostMapping("/ImportExceptionData")
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
DownloadVO vo=DownloadVO.builder().build();
List<AreaExcelErrorVO> areaVOList = JsonUtil.getJsonToList(visualImportModel.getList(), AreaExcelErrorVO.class);
UserInfo userInfo = userProvider.get();
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams,
AreaExcelErrorVO.class, areaVOList);
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);
int i =0;
for (String allId : idList){
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param areaForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid AreaForm areaForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
areaForm.setId(id);
if (!isImport) {
String b = areaService.checkForm(areaForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
AreaEntity entity= areaService.getInfo(id);
if(entity!=null){
try{
areaService.saveOrUpdate(areaForm,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){
AreaEntity entity= areaService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
areaService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
AreaEntity entity= areaService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> areaMap=JsonUtil.entityToMap(entity);
areaMap.put("id", areaMap.get("id"));
//副表数据
//子表数据
areaMap = generaterSwapUtil.swapDataDetail(areaMap,AreaConstant.getFormData(),"582494130148475397",false);
return ActionResult.success(areaMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
AreaEntity entity= areaService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> areaMap=JsonUtil.entityToMap(entity);
areaMap.put("id", areaMap.get("id"));
//副表数据
//子表数据
areaMap = generaterSwapUtil.swapDataForm(areaMap,AreaConstant.getFormData(),AreaConstant.TABLEFIELDKEY,AreaConstant.TABLERENAMES);
return ActionResult.success(areaMap);
}
}

@ -54,12 +54,12 @@ import org.springframework.transaction.annotation.Transactional;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-12
* @ 2024-07-15
*/
@Slf4j
@RestController
@Tag(name = "park" , description = "scm")
@RequestMapping("/api/scm/Park")
@Tag(name = "park" , description = "example")
@RequestMapping("/api/example/Park")
public class ParkController {
@Autowired
@ -161,18 +161,21 @@ public class ParkController {
if(keys.length>0){
for(String key:keys){
switch(key){
case "parkNumber" :
entitys.add(new ExcelExportEntity("园区编码" ,"parkNumber"));
case "code" :
entitys.add(new ExcelExportEntity("园区编码" ,"code"));
break;
case "parkName" :
entitys.add(new ExcelExportEntity("园区名称" ,"parkName"));
case "name" :
entitys.add(new ExcelExportEntity("园区名称" ,"name"));
break;
case "parkDescribe" :
entitys.add(new ExcelExportEntity("园区描述" ,"parkDescribe"));
case "describe" :
entitys.add(new ExcelExportEntity("描述" ,"describe"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "type" :
entitys.add(new ExcelExportEntity("类型" ,"type"));
break;
default:
break;
}
@ -270,8 +273,8 @@ public class ParkController {
//主表对象
List<ExcelExportEntity> entitys = new ArrayList<>();
//以下添加字段
entitys.add(new ExcelExportEntity("园区编码" ,"parkNumber"));
entitys.add(new ExcelExportEntity("园区名称" ,"parkName"));
entitys.add(new ExcelExportEntity("园区编码" ,"code"));
entitys.add(new ExcelExportEntity("园区名称" ,"name"));
List<Map<String, Object>> list = new ArrayList<>();
list.add(dataMap);
@ -326,8 +329,8 @@ public class ParkController {
List<ParkExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, ParkExcelVO.class, params);
// 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("parkNumber","园区编码"));
columns.add(new ExcelImFieldModel("parkName","园区名称"));
columns.add(new ExcelImFieldModel("code","园区编码"));
columns.add(new ExcelImFieldModel("name","园区名称"));
headAndDataMap.put("dataRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(excelDataList)));
headAndDataMap.put("headerRow" , JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(columns)));
} catch (Exception e){

@ -0,0 +1,76 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Data
@TableName("yq_park_area_space")
public class AreaEntity {
@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 = "PID" , updateStrategy = FieldStrategy.IGNORED)
private String pid;
@TableField(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String description;
@TableField("TYPE")
private String type;
@TableField(value = "SPACE_NUM" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal spaceNum;
@TableField("SPACE_AREA")
private BigDecimal spaceArea;
@TableField("SPACE_TYPE")
private String spaceType;
@TableField("STATE")
private String state;
@TableField("UNIT_PRICE")
private BigDecimal unitPrice;
@TableField("LEASE_START_TIME")
private Date leaseStartTime;
@TableField("LEASE_END_IME")
private Date leaseEndIme;
@TableField("SORT")
private Long sort;
@TableField(value = "REMARK" , updateStrategy = FieldStrategy.IGNORED)
private String remark;
@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("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_FLOW_ID")
private String flowId;
}

@ -0,0 +1,73 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
@TableName("yq_park_area_space")
public class ParkEntity {
@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("PID")
private String pid;
@TableField(value = "DESCRIPTION" , updateStrategy = FieldStrategy.IGNORED)
private String description;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type;
@TableField("SPACE_AREA")
private BigDecimal spaceArea;
@TableField("SPACE_TYPE")
private String spaceType;
@TableField("STATE")
private String state;
@TableField("UNIT_PRICE")
private BigDecimal unitPrice;
@TableField("LEASE_START_TIME")
private Date leaseStartTime;
@TableField("LEASE_END_IME")
private Date leaseEndIme;
@TableField("SORT")
private Long sort;
@TableField(value = "REMARK" , updateStrategy = FieldStrategy.IGNORED)
private String remark;
@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("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("ORGANIZE_JSON_ID")
private String organizeJsonId;
@TableField("F_VERSION")
private Integer version;
@TableField("F_FLOW_ID")
private String flowId;
}

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

@ -0,0 +1,46 @@
package jnpf.model.area;
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;
/**
*
* area
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Data
public class AreaExcelVO{
/** 园区名称 **/
@JSONField(name = "pid")
@Excel(name = "园区名称",orderNum = "1", isImportField = "true" )
private String pid;
/** 区域编码 **/
@JSONField(name = "code")
@Excel(name = "区域编码",orderNum = "1", isImportField = "true" )
private String code;
/** 空间数量 **/
@JSONField(name = "spaceNum")
@Excel(name = "空间数量",orderNum = "1", isImportField = "true" )
private Integer spaceNum;
/** 区域名称 **/
@JSONField(name = "name")
@Excel(name = "区域名称",orderNum = "1", isImportField = "true" )
private String name;
}

@ -0,0 +1,41 @@
package jnpf.model.area;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* area
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Data
public class AreaForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 园区名称 **/
@JsonProperty("pid")
private String pid;
/** 区域编码 **/
@JsonProperty("code")
private String code;
/** 空间数量 **/
@JsonProperty("spaceNum")
private BigDecimal spaceNum;
/** 区域名称 **/
@JsonProperty("name")
private String name;
/** 区域描述 **/
@JsonProperty("description")
private String description;
/** 备注 **/
@JsonProperty("remark")
private String remark;
}

@ -0,0 +1,36 @@
package jnpf.model.area;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* area
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-16
*/
@Data
public class AreaPagination 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("name")
private Object name;
/** tree */
@JsonProperty("pid")
private Object pid;
}

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

@ -0,0 +1,36 @@
package jnpf.model.park;
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;
/**
*
* park
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
public class ParkExcelVO{
/** 园区编码 **/
@JSONField(name = "code")
@Excel(name = "园区编码",orderNum = "1", isImportField = "true" )
private String code;
/** 园区名称 **/
@JSONField(name = "name")
@Excel(name = "园区名称",orderNum = "1", isImportField = "true" )
private String name;
}

@ -0,0 +1,41 @@
package jnpf.model.park;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* park
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
public class ParkForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 园区编码 **/
@JsonProperty("code")
private String code;
/** 园区名称 **/
@JsonProperty("name")
private String name;
/** 父id **/
@JsonProperty("pid")
private String pid;
/** 描述 **/
@JsonProperty("description")
private String description;
/** 备注 **/
@JsonProperty("remark")
private String remark;
/** 类型 **/
@JsonProperty("type")
private Object type;
}

@ -0,0 +1,36 @@
package jnpf.model.park;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* park
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-15
*/
@Data
public class ParkPagination 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("name")
private Object name;
/** 类型 */
@JsonProperty("type")
private String type;
}

@ -41,7 +41,7 @@ Thumbs.db
.svn/
*.swp
*.swo
*.log
# *.log
*.log.*
*.json.gzip
node_modules/

@ -0,0 +1,135 @@
<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="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label="园区名称"
prop="pid" >
<p>{{dataForm.pid}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="区域编码"
prop="code" >
<p>{{dataForm.code}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间数量"
prop="spaceNum" >
<JnpfNumber v-model="dataForm.spaceNum"
placeholder="数字文本" disabled
:step="1" >
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="区域名称"
prop="name" >
<p>{{dataForm.name}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="区域描述"
prop="description" >
<p>{{dataForm.description}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</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 :'',
pid : '',
code : '',
spaceNum : '',
name : '',
description : '',
remark : '',
},
}
},
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/example/Area/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,482 @@
<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="100px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24" >
<jnpf-form-tip-item
label="园区名称" prop="pid" >
<JnpfInput v-model="dataForm.pid" @change="changeData('pid',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item
label="区域编码" prop="code" >
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item
label="空间数量" prop="spaceNum" >
<JnpfInputNumber v-model="dataForm.spaceNum" @change="changeData('spaceNum',-1)"
placeholder="数字文本" :step="1" >
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item
label="区域名称" prop="name" >
<JnpfInput v-model="dataForm.name" @change="changeData('name',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="区域描述" prop="description" >
<JnpfInput v-model="dataForm.description" @change="changeData('description',-1)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item
label="备注" prop="remark" >
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-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>
</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: {
pid : undefined,
code : undefined,
spaceNum : undefined,
name : undefined,
description : undefined,
remark : undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
pid: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
code: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
spaceNum: [
{
required: true,
message: '数字文本',
trigger: ["blur","change"]
},
],
name: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
},
childIndex:-1,
isEdit:false,
interfaceRes: {
pid:[] ,
code:[] ,
spaceNum:[] ,
name:[] ,
description:[] ,
remark:[] ,
},
}
},
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/example/Area/'+ 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/example/Area/'+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/example/Area',
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/example/Area/'+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>

@ -0,0 +1,572 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>左侧标题</h2>
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="toggleTreeExpand(true)">展开全部</el-dropdown-item>
<el-dropdown-item @click.native="toggleTreeExpand(false)">折叠全部</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="JNPF-common-tree-search-box">
<el-input placeholder="输入关键字" v-model="keyword" suffix-icon="el-icon-search" clearable />
</div>
<el-tree :data="treeData"
class="JNPF-common-el-tree" highlight-current
ref="treeBox" :expand-on-click-node="false" @node-click="handleNodeClick"
node-key="id"
:props="treeProps"
:default-expand-all="expandsTree"
:filter-node-method="filterNode"
:lazy="false"
v-if="refreshTree">
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{node.label}}</span>
</span>
</el-tree>
</div>
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="区域名称">
<el-input v-model="query.name" 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" @click="addOrUpdateHandle()">
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()" >导出
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-upload" @click="handelUpload()" >导入
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()" >批量删除
</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="pid"
label="园区名称" align="left"
>
</el-table-column>
<el-table-column
prop="code"
label="区域编码" align="left"
>
</el-table-column>
<el-table-column
prop="spaceNum"
label="空间数量" align="left"
>
<template slot-scope="scope" v-if="scope.row.spaceNum" >
<JnpfNumber v-model="scope.row.spaceNum" :thousands="false"/>
</template>
</el-table-column>
<el-table-column
prop="name"
label="区域名称" align="left"
>
</el-table-column>
<el-table-column
prop="description"
label="区域描述" align="left"
>
</el-table-column>
<el-table-column
prop="remark"
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)" >编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">
</el-button>
<el-button type="text"
@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'
export default {
components: {
JNPFForm,
Detail,
ExportBox,ToFormDetail , SuperQuery
},
data() {
return {
keyword:'',
expandsTree: true,
refreshTree: true,
toFormDetailVisible:false,
expandObj:{},
columnOptions: [],
mergeList: [],
exportList:[],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
name:undefined,
},
treeProps: {
children: 'children',
label: 'name',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
multipleSelection: [], total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
treeData: [],
treeActiveId: '',
interfaceRes: {
},
}
},
watch: {
keyword(val) {
this.$refs.treeBox.filter(val)
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.getTreeView();
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()
},
getTreeView() {
getDataInterfaceRes('582550261134787397').then(res => {
let data = res.data
this.treeData = data
this.initSearchDataAndListData()
})
},
getNodePath(node) {
let fullPath = []
const loop = (node) => {
if (node.level) fullPath.unshift(node.data)
if (node.parent) loop(node.parent)
}
loop(node)
return fullPath
},
handleNodeClick(data,node) {
this.treeActiveId = data.id
for(let key in this.query)
{
this.query[key] = undefined
}
this.query.pid = data.id
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
}
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {
},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId:this.menuId,
moduleId:'582494130148475397',
type:2,
};
request({
url: `/api/example/Area/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/example/Area/${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("","example/Area")
})
},
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/example/Area/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/example/Area/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>

File diff suppressed because one or more lines are too long

@ -1,114 +1,121 @@
<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="parkNumber">
<p>{{ dataForm.parkNumber }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="园区名称" prop="parkName">
<p>{{ dataForm.parkName }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="园区描述" prop="parkDescribe">
<p>{{ dataForm.parkDescribe }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<p>{{ dataForm.remark }}</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>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
<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="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="12" >
<jnpf-form-tip-item label="园区编码"
prop="code" >
<p>{{dataForm.code}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="园区名称"
prop="name" >
<p>{{dataForm.name}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="描述"
prop="describe" >
<p>{{dataForm.describe}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
</div>
</transition>
</template>
<script>
import request from "@/utils/request";
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,
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: "",
parkNumber: "",
parkName: "",
parkDescribe: "",
remark: ""
}
};
},
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;
},
dataForm: {
id :'',
code : '',
name : '',
describe : '',
remark : '',
type : "1",
},
typeOptions:[{"fullName":"园区","id":"1"},{"fullName":"区域","id":"2"},{"fullName":"空间","id":"3"}],
typeProps:{"label":"fullName","value":"id" },
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true;
request({
url: "/api/scm/Park/detail/" + this.dataForm.id,
method: "get"
}).then(res => {
this.dataInfo(res.data);
this.loading = false;
});
}
});
},
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/example/Park/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,106 +1,125 @@
<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="parkNumber">
<JnpfInput
v-model="dataForm.parkNumber"
@change="changeData('parkNumber', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="园区名称" prop="parkName">
<JnpfInput
v-model="dataForm.parkName"
@change="changeData('parkName', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
<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"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="园区描述" prop="parkDescribe">
<JnpfInput
v-model="dataForm.parkDescribe"
@change="changeData('parkDescribe', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
{{
!dataForm.id ? "确定并新增" : "确定并继续"
}}</el-dropdown-item
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<JnpfInput
v-model="dataForm.remark"
@change="changeData('remark', -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>
</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-button
type="primary"
@click="dataFormSubmit(2)"
:loading="continueBtnLoading"
>
{{ !dataForm.id ? "确定并新增" : "确定并继续" }}</el-button
<el-row
:gutter="15"
class=" main"
:style="{ margin: '0 auto', width: '100%' }"
>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">
</el-button
>
</span>
</el-dialog>
<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="code">
<JnpfInput
v-model="dataForm.code"
@change="changeData('code', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="园区名称" prop="name">
<JnpfInput
v-model="dataForm.name"
@change="changeData('name', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="描述" prop="description">
<JnpfInput
v-model="dataForm.description"
@change="changeData('description', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<JnpfInput
v-model="dataForm.remark"
@change="changeData('remark', -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>
</div>
</transition>
</template>
<script>
@ -146,22 +165,23 @@ export default {
Vmodel: "",
currVmodel: "",
dataForm: {
parkNumber: undefined,
parkName: undefined,
parkDescribe: undefined,
code: undefined,
name: undefined,
description: undefined,
remark: undefined,
type: "1",
version: 0
},
tableRequiredData: {},
dataRule: {
parkNumber: [
code: [
{
required: true,
message: "请输入",
trigger: "blur"
}
],
parkName: [
name: [
{
required: true,
message: "请输入",
@ -169,13 +189,20 @@ export default {
}
]
},
typeOptions: [
{ fullName: "园区", id: "1" },
{ fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
],
typeProps: { label: "fullName", value: "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
parkNumber: [],
parkName: [],
parkDescribe: [],
remark: []
code: [],
name: [],
description: [],
remark: [],
type: []
}
};
},
@ -218,7 +245,7 @@ export default {
},
getInfo(id) {
request({
url: "/api/scm/Park/" + id,
url: "/api/example/Park/" + id,
method: "get"
}).then(res => {
this.dataInfo(res.data);
@ -267,6 +294,9 @@ export default {
}
},
dataAll() {},
goBack() {
this.$emit("refresh");
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
},
@ -292,7 +322,7 @@ export default {
if (this.dataForm.id) {
this.loading = true;
request({
url: "/api/scm/Park/" + this.dataForm.id,
url: "/api/example/Park/" + this.dataForm.id,
method: "get"
}).then(res => {
this.dataInfo(res.data);
@ -325,7 +355,7 @@ export default {
}
if (!this.dataForm.id) {
request({
url: "/api/scm/Park",
url: "/api/example/Park",
method: "post",
data: _data
})
@ -355,7 +385,7 @@ export default {
});
} else {
request({
url: "/api/scm/Park/" + this.dataForm.id,
url: "/api/example/Park/" + this.dataForm.id,
method: "PUT",
data: _data
})

@ -5,7 +5,7 @@
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="园区名称">
<el-input v-model="query.parkName" placeholder="请输入" clearable>
<el-input v-model="query.name" placeholder="请输入" clearable>
</el-input>
</el-form-item>
</el-col>
@ -78,14 +78,19 @@
@selection-change="handleSelectionChange"
:span-method="arraySpanMethod"
>
<el-table-column prop="parkNumber" label="园区编码" align="left">
<el-table-column prop="code" label="园区编码" align="left">
</el-table-column>
<el-table-column prop="parkName" label="园区名称" align="left">
<el-table-column prop="name" label="园区名称" align="left">
</el-table-column>
<el-table-column prop="parkDescribe" label="园区描述" align="left">
<el-table-column prop="description" label="园区描述" align="left">
</el-table-column>
<el-table-column prop="remark" label="备注" align="left">
</el-table-column>
<!-- <el-table-column label="类型" prop="type" algin="left">
<template slot-scope="scope">
{{ scope.row.type }}
</template>
</el-table-column> -->
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)"
@ -176,7 +181,8 @@ export default {
uploadBoxVisible: false,
detailVisible: false,
query: {
parkName: undefined
type: "1",
name: undefined
},
treeProps: {
children: "children",
@ -201,6 +207,12 @@ export default {
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
typeOptions: [
{ fullName: "园区", id: "1" },
{ fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
],
typeProps: { label: "fullName", value: "id" },
interfaceRes: {}
};
},
@ -392,7 +404,7 @@ export default {
type: 1
};
request({
url: `/api/scm/Park/getList`,
url: `/api/example/Park/getList`,
method: "post",
data: _query
}).then(res => {
@ -411,7 +423,7 @@ export default {
})
.then(() => {
request({
url: `/api/scm/Park/${id}`,
url: `/api/example/Park/${id}`,
method: "DELETE"
}).then(res => {
this.$message({
@ -428,7 +440,7 @@ export default {
handelUpload() {
this.uploadBoxVisible = true;
this.$nextTick(() => {
this.$refs.UploadBox.init("", "scm/Park");
this.$refs.UploadBox.init("", "example/Park");
});
},
handleSelectionChange(val) {
@ -450,7 +462,7 @@ export default {
})
.then(() => {
request({
url: `/api/scm/Park/batchRemove`,
url: `/api/example/Park/batchRemove`,
data: ids,
method: "DELETE"
}).then(res => {
@ -497,7 +509,7 @@ export default {
menuId: this.menuId
};
request({
url: `/api/scm/Park/Actions/Export`,
url: `/api/example/Park/Actions/Export`,
method: "post",
data: query
}).then(res => {

@ -1,2 +1,2 @@
const superQueryJson = [{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"园区编码","addonAfter":"","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"园区编码","trigger":"blur","showLabel":true,"required":true,"tableName":"yq_park","renderKey":1720767684035,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":true,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"parkNumber","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"parkNumber","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"园区名称","addonAfter":"","__config__":{"formId":102,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"园区名称","trigger":"blur","showLabel":true,"required":true,"tableName":"yq_park","renderKey":1720767686366,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"parkName","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"parkName","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"园区描述","addonAfter":"","__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"园区描述","trigger":"blur","showLabel":true,"required":false,"tableName":"yq_park","renderKey":1720767686553,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"parkDescribe","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"parkDescribe","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"备注","addonAfter":"","__config__":{"formId":104,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"备注","trigger":"blur","showLabel":true,"required":false,"tableName":"yq_park","renderKey":1720767686749,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"remark","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"remark","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}]
const superQueryJson = [{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"园区编码","addonAfter":"","__config__":{"formId":101,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"园区编码","trigger":"blur","showLabel":true,"required":true,"tableName":"yq_park_area_space","renderKey":1720767684035,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":true,"tag":"JnpfInput","regList":[],"span":12},"readonly":false,"showWordLimit":false,"__vModel__":"code","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"code","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"园区名称","addonAfter":"","__config__":{"formId":102,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"园区名称","trigger":"blur","showLabel":true,"required":true,"tableName":"yq_park_area_space","renderKey":1720767686366,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":12},"readonly":false,"showWordLimit":false,"__vModel__":"name","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"name","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"描述","addonAfter":"","__config__":{"formId":103,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"描述","trigger":"blur","showLabel":true,"required":false,"tableName":"yq_park_area_space","renderKey":1720767686553,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":12},"readonly":false,"showWordLimit":false,"__vModel__":"describe","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"describe","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"clearable":true,"maxlength":null,"suffixIcon":"","fullName":"备注","addonAfter":"","__config__":{"formId":104,"visibility":["pc","app"],"jnpfKey":"input","noShow":false,"tipLabel":"","dragDisabled":false,"className":[],"label":"备注","trigger":"blur","showLabel":true,"required":false,"tableName":"yq_park_area_space","renderKey":1720767686749,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-input","unique":false,"tag":"JnpfInput","regList":[],"span":24},"readonly":false,"showWordLimit":false,"__vModel__":"remark","showPassword":false,"style":{"width":"100%"},"disabled":false,"id":"remark","placeholder":"请输入","prefixIcon":"","addonBefore":"","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}","blur":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}},{"filterable":false,"clearable":true,"multiple":false,"fullName":"类型","props":{"label":"fullName","value":"id"},"__config__":{"formId":105,"visibility":["pc","app"],"jnpfKey":"select","defaultValue":"1","noShow":true,"dataType":"static","dictionaryType":"","tipLabel":"","dragDisabled":false,"className":[],"label":"类型","trigger":"change","propsUrl":"","templateJson":[],"showLabel":true,"required":false,"tableName":"yq_park_area_space","renderKey":1721036412554,"layout":"colFormItem","tagIcon":"icon-ym icon-ym-generator-select","propsName":"","tag":"JnpfSelect","regList":[],"span":24},"options":[{"fullName":"园区","id":"1"},{"fullName":"区域","id":"2"},{"fullName":"空间","id":"3"}],"__vModel__":"type","style":{"width":"100%"},"disabled":false,"interfaceHasPage":false,"id":"type","placeholder":"请选择","on":{"change":"({ data, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}"}}]
export default superQueryJson

@ -0,0 +1,135 @@
<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="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="12" >
<jnpf-form-tip-item label="园区名称"
prop="parkId" >
<p>{{dataForm.parkId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="区域编码"
prop="regionNumber" >
<p>{{dataForm.regionNumber}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="区域名称"
prop="regionName" >
<p>{{dataForm.regionName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间数量"
prop="spacesNumber" >
<JnpfNumber v-model="dataForm.spacesNumber"
placeholder="数字文本" disabled
:step="1" >
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="区域描述"
prop="regionDescribe" >
<p>{{dataForm.regionDescribe}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remarks" >
<p>{{dataForm.remarks}}</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 :'',
parkId : "",
regionNumber : '',
regionName : '',
spacesNumber : '',
regionDescribe : '',
remarks : '',
},
}
},
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/example/Regional/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,553 @@
<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="100px"
label-position="right"
>
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12">
<jnpf-form-tip-item label="园区名称" prop="parkId">
<JnpfPopupSelect
v-model="dataForm.parkId"
@change="changeData('parkId', -1)"
:rowIndex="null"
:formData="dataForm"
:templateJson="interfaceRes.parkId"
placeholder="请选择"
propsValue="id"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="park_name"
field="parkId"
interfaceId="582491427901014533"
:pageSize="20"
:columnOptions="parkIdcolumnOptions"
clearable
:style="{ width: '100%' }"
>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="区域编码" prop="regionNumber">
<JnpfInput
v-model="dataForm.regionNumber"
@change="changeData('regionNumber', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="区域名称" prop="regionName">
<JnpfInput
v-model="dataForm.regionName"
@change="changeData('regionName', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="空间数量" prop="spacesNumber">
<JnpfInputNumber
v-model="dataForm.spacesNumber"
@change="changeData('spacesNumber', -1)"
placeholder="数字文本"
:step="1"
>
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="区域描述" prop="regionDescribe">
<JnpfInput
v-model="dataForm.regionDescribe"
@change="changeData('regionDescribe', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remarks">
<JnpfInput
v-model="dataForm.remarks"
@change="changeData('remarks', -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>
</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: {
parkId: undefined,
regionNumber: undefined,
regionName: undefined,
spacesNumber: undefined,
regionDescribe: undefined,
remarks: undefined,
version: 0
},
tableRequiredData: {},
dataRule: {
parkId: [
{
required: true,
message: "请选择",
trigger: "change"
}
],
regionNumber: [
{
required: true,
message: "请输入",
trigger: "blur"
}
],
regionName: [
{
required: true,
message: "请输入",
trigger: "blur"
}
],
spacesNumber: [
{
required: true,
message: "数字文本",
trigger: ["blur", "change"]
}
]
},
parkIdcolumnOptions: [
{ label: "园区编码", value: "park_number" },
{ label: "园区名称", value: "park_name" }
],
childIndex: -1,
isEdit: false,
interfaceRes: {
parkId: [],
regionNumber: [],
regionName: [],
spacesNumber: [],
regionDescribe: [],
remarks: []
}
};
},
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/example/Regional/" + 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/example/Regional/" + 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/example/Regional",
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/example/Regional/" + 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>

@ -0,0 +1,631 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>{{ title }}</h2>
<el-dropdown>
<el-link icon="icon-ym icon-ym-mpMenu" :underline="false" />
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="toggleTreeExpand(true)"
>展开全部</el-dropdown-item
>
<el-dropdown-item @click.native="toggleTreeExpand(false)"
>折叠全部</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</div>
<div class="JNPF-common-tree-search-box">
<el-input
placeholder="输入关键字"
v-model="keyword"
suffix-icon="el-icon-search"
clearable
/>
</div>
<el-tree
:data="treeData"
class="JNPF-common-el-tree"
highlight-current
ref="treeBox"
:expand-on-click-node="false"
@node-click="handleNodeClick"
node-key="id"
:props="treeProps"
:default-expand-all="expandsTree"
:filter-node-method="filterNode"
:lazy="false"
v-if="refreshTree"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<i :class="data.icon"></i>
<span class="text">{{ node.label }}</span>
</span>
</el-tree>
</div>
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="区域名称">
<el-input
v-model="query.regionName"
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"
@click="addOrUpdateHandle()"
>新增
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-download"
@click="exportData()"
>导出
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-upload"
@click="handelUpload()"
>导入
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-clearn"
@click="handleBatchRemoveDel()"
>
批量删除
</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="parkId" label="园区名称" align="left">
</el-table-column>
<el-table-column prop="regionNumber" label="区域编码" align="left">
</el-table-column>
<el-table-column prop="regionName" label="区域名称" align="left">
</el-table-column>
<el-table-column prop="regionDescribe" label="区域描述" align="left">
</el-table-column>
<el-table-column prop="spacesNumber" label="空间数量" align="left">
<template slot-scope="scope" v-if="scope.row.spacesNumber">
<JnpfNumber v-model="scope.row.spacesNumber" :thousands="false" />
</template>
</el-table-column>
<el-table-column prop="remarks" 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)"
>编辑
</el-button>
<el-button
type="text"
class="JNPF-table-delBtn"
@click="handleDel(scope.row.id)"
>删除
</el-button>
<el-button type="text" @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";
export default {
components: {
JNPFForm,
Detail,
ExportBox,
ToFormDetail,
SuperQuery
},
data() {
return {
title: "",
keyword: "",
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
regionName: undefined
},
treeProps: {
children: "children",
label: "name",
value: "id",
isLeaf: "isLeaf"
},
list: [],
listLoading: true,
multipleSelection: [],
total: 0,
queryData: {},
listQuery: {
superQueryJson: "",
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: ""
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
treeData: [],
treeActiveId: "",
interfaceRes: {
parkId: []
}
};
},
watch: {
keyword(val) {
this.$refs.treeBox.filter(val);
}
},
computed: {
...mapGetters(["userInfo"]),
menuId() {
return this.$route.meta.modelId || "";
}
},
created() {
this.getColumnList(), this.getTreeView();
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();
},
getTreeView() {
request({
url: `/api/example/Regional/regionalTree`,
method: "get"
}).then(res => {
debugger;
this.treeData = res.data;
this.initSearchDataAndListData();
});
},
getNodePath(node) {
let fullPath = [];
const loop = node => {
if (node.level) fullPath.unshift(node.data);
if (node.parent) loop(node.parent);
};
loop(node);
return fullPath;
},
handleNodeClick(data, node) {
debugger;
this.title = data.name;
this.treeActiveId = data.id;
for (let key in this.query) {
this.query[key] = undefined;
}
this.query.parkId = data.id;
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: ""
};
this.initData();
},
async initSearchDataAndListData() {
await this.initSearchData();
this.initData();
},
//
async initSearchData() {},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: "582494130148475397",
type: 2
};
request({
url: `/api/example/Regional/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/example/Regional/${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("", "example/Regional");
});
},
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/example/Regional/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/example/Regional/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>

File diff suppressed because one or more lines are too long

@ -0,0 +1,156 @@
<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="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="12" >
<jnpf-form-tip-item label="区域名称"
prop="regionId" >
<p>{{dataForm.regionId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间编码"
prop="spaceCode" >
<p>{{dataForm.spaceCode}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间名称"
prop="spaceName" >
<p>{{dataForm.spaceName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间面积"
prop="spaceArea" >
<JnpfNumber v-model="dataForm.spaceArea"
placeholder="数字文本" disabled
:step="1" addonAfter="m²" >
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="空间类型"
prop="spaceType" >
<p>{{ dataForm.spaceType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="单价"
prop="unitPrice" >
<JnpfNumber v-model="dataForm.unitPrice"
placeholder="数字文本" disabled
:step="1" addonAfter="元/m²" >
</JnpfNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="状态"
prop="state" >
<p>{{ dataForm.state }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</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 :'',
regionId : "",
spaceCode : '',
spaceName : '',
spaceArea : '',
spaceType : "",
unitPrice : '',
state : "10",
remark : '',
},
spaceTypeOptions:[{"fullName":"办公室","id":"10"},{"fullName":"加工车间","id":"20"}],
spaceTypeProps:{"label":"fullName","value":"id" },
stateOptions:[{"fullName":"待租","id":"10"},{"fullName":"已租","id":"20"},{"fullName":"装修","id":"30"},{"fullName":"预约","id":"40"}],
stateProps:{"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/example/Spatial/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,606 @@
<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="100px"
label-position="right"
>
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12">
<jnpf-form-tip-item label="区域名称" prop="regionId">
<JnpfPopupSelect
v-model="dataForm.regionId"
@change="changeData('regionId', -1)"
:rowIndex="null"
:formData="dataForm"
:templateJson="interfaceRes.regionId"
placeholder="请选择"
propsValue="id"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="region_name"
field="regionId"
interfaceId="582538983687324421"
:pageSize="20"
:columnOptions="regionIdcolumnOptions"
clearable
:style="{ width: '100%' }"
>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="空间编码" prop="spaceCode">
<JnpfInput
v-model="dataForm.spaceCode"
@change="changeData('spaceCode', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="空间名称" prop="spaceName">
<JnpfInput
v-model="dataForm.spaceName"
@change="changeData('spaceName', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="空间面积" prop="spaceArea">
<JnpfInputNumber
v-model="dataForm.spaceArea"
@change="changeData('spaceArea', -1)"
placeholder="数字文本"
addonAfter="m²"
:step="1"
>
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="空间类型" prop="spaceType">
<JnpfSelect
v-model="dataForm.spaceType"
@change="changeData('spaceType', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="spaceTypeOptions"
:props="spaceTypeProps"
>
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="单价" prop="unitPrice">
<JnpfInputNumber
v-model="dataForm.unitPrice"
@change="changeData('unitPrice', -1)"
placeholder="数字文本"
addonAfter="元/m²"
:step="1"
>
</JnpfInputNumber>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12">
<jnpf-form-tip-item label="状态" prop="state">
<JnpfSelect
v-model="dataForm.state"
@change="changeData('state', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="stateOptions"
:props="stateProps"
>
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<JnpfInput
v-model="dataForm.remark"
@change="changeData('remark', -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>
</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: {
regionId: undefined,
spaceCode: undefined,
spaceName: undefined,
spaceArea: undefined,
spaceType: undefined,
unitPrice: undefined,
state: "10",
remark: undefined,
version: 0
},
tableRequiredData: {},
dataRule: {
regionId: [
{
required: true,
message: "请选择",
trigger: "change"
}
],
spaceCode: [
{
required: true,
message: "请输入",
trigger: "blur"
}
],
spaceName: [
{
required: true,
message: "请输入",
trigger: "blur"
}
],
spaceArea: [
{
required: true,
message: "数字文本",
trigger: ["blur", "change"]
}
],
spaceType: [
{
required: true,
message: "请选择",
trigger: "change"
}
]
},
regionIdcolumnOptions: [
{ label: "区域编码", value: "region_number" },
{ label: "区域名称", value: "region_name" },
{ label: "空间数量", value: "spaces_number" }
],
spaceTypeOptions: [
{ fullName: "办公室", id: "10" },
{ fullName: "加工车间", id: "20" }
],
spaceTypeProps: { label: "fullName", value: "id" },
stateOptions: [
{ fullName: "待租", id: "10" },
{ fullName: "已租", id: "20" },
{ fullName: "装修", id: "30" },
{ fullName: "预约", id: "40" }
],
stateProps: { label: "fullName", value: "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
regionId: [],
spaceCode: [],
spaceName: [],
spaceArea: [],
spaceType: [],
unitPrice: [],
state: [],
remark: []
}
};
},
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/example/Spatial/" + 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/example/Spatial/" + 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/example/Spatial",
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/example/Spatial/" + 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>

@ -0,0 +1,569 @@
<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.spaceName"
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"
@click="addOrUpdateHandle()"
>新增
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-download"
@click="exportData()"
>导出
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-upload"
@click="handelUpload()"
>导入
</el-button>
<el-button
type="text"
icon="icon-ym icon-ym-btn-clearn"
@click="handleBatchRemoveDel()"
>批量删除
</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="regionId" label="区域名称" align="left">
</el-table-column>
<el-table-column prop="spaceCode" label="空间编码" align="left">
</el-table-column>
<el-table-column prop="spaceName" label="空间名称" align="left">
</el-table-column>
<el-table-column prop="spaceArea" label="空间面积" align="left">
<template slot-scope="scope" v-if="scope.row.spaceArea">
<JnpfNumber v-model="scope.row.spaceArea" :thousands="false" />
</template>
</el-table-column>
<el-table-column label="空间类型" prop="spaceType" algin="left">
<template slot-scope="scope">
{{ scope.row.spaceType }}
</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" align="left">
<template slot-scope="scope" v-if="scope.row.unitPrice">
<JnpfNumber v-model="scope.row.unitPrice" :thousands="false" />
</template>
</el-table-column>
<el-table-column label="状态" prop="state" algin="left">
<template slot-scope="scope">
{{ scope.row.state }}
</template>
</el-table-column>
<el-table-column prop="remark" 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)"
>编辑
</el-button>
<el-button
type="text"
class="JNPF-table-delBtn"
@click="handleDel(scope.row.id)"
>删除
</el-button>
<el-button type="text" @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";
export default {
components: {
JNPFForm,
Detail,
ExportBox,
ToFormDetail,
SuperQuery
},
data() {
return {
keyword: "",
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
spaceName: 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,
spaceTypeOptions: [
{ fullName: "办公室", id: "10" },
{ fullName: "加工车间", id: "20" }
],
spaceTypeProps: { label: "fullName", value: "id" },
stateOptions: [
{ fullName: "待租", id: "10" },
{ fullName: "已租", id: "20" },
{ fullName: "装修", id: "30" },
{ fullName: "预约", id: "40" }
],
stateProps: { label: "fullName", value: "id" },
interfaceRes: {
regionId: []
}
};
},
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;
}
}
}
}
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: "582541735268188933",
type: 1
};
request({
url: `/api/example/Spatial/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/example/Spatial/${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("", "example/Spatial");
});
},
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/example/Spatial/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/example/Spatial/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>

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