空间管理

master
vayne 3 months ago
parent ce13296d4d
commit 3b70219747

@ -0,0 +1,56 @@
<?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.SpaceMapper">
<select id="querySpaceList" resultType="jnpf.entity.SpaceEntity">
SELECT
a.id,
a.code,
a.name,
a.pid,
a.description,
a.type,
a.space_num as spaceNum,
a.space_area as spaceArea,
a.space_type as spaceType,
a.state,
a.unit_price as unitPrice,
a.lease_start_time as leaseStartTime,
a.lease_end_ime as leaseEndIme,
a.sort,
a.remark,
a.f_creator_time as createTime,
a.f_creator_user_id as creatorUserId,
a.f_last_modify_time as laseModifyTime,
a.f_last_modify_user_id as lastModifyUserId,
a.f_delete_time as deleteTime,
a.f_delete_user_id as deleteUserId,
a.f_delete_mark as deleteMark,
a.f_tenant_id as tenantId,
a.company_id as companyId,
a.department_id as departmentId,
a.organize_json_id as organizeJsonId,
a.f_version as version,
a.f_flow_id as flowId,
b.name as areaName,
case a.state
when '10' then '待租'
when '20' then '已租'
when '30' then '装修'
when '40' then '预约'
end as state1,
case a.space_type
when '10' then '办公室'
when '20' then '加工车间'
end as spaceType1
FROM
yq_park_area_space a
LEFT JOIN yq_park_area_space b on a.pid = b.id and b.f_delete_mark is null
${ew.customSqlSegment}
<if test="spacePagination.sidx != null and spacePagination.sidx != ''">
ORDER BY ${spacePagination.sidx} ${spacePagination.sort}
</if>
</select>
</mapper>

@ -0,0 +1,24 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jnpf.entity.AreaEntity;
import jnpf.entity.SpaceEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.model.area.AreaPagination;
import jnpf.model.space.SpacePagination;
import org.apache.ibatis.annotations.Param;
/**
* space
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-23
*/
public interface SpaceMapper extends BaseMapper<SpaceEntity> {
IPage<SpaceEntity> querySpaceList(@Param("page") Page<SpaceEntity> page, @Param("spacePagination") SpacePagination spacePagination, @Param("ew") QueryWrapper<SpaceEntity> areaQueryWrapper);
}

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

@ -150,6 +150,10 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, AreaEntity> impleme
} }
} }
if(isPc){ if(isPc){
if (StringUtils.isNotEmpty(areaPagination.getParkName())){
areaNum++;
areaQueryWrapper.like("b.name",areaPagination.getParkName());
}
if(ObjectUtil.isNotEmpty(areaPagination.getName())){ if(ObjectUtil.isNotEmpty(areaPagination.getName())){
areaNum++; areaNum++;

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

@ -0,0 +1,532 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.exception.DataException;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.space.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.*;
import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import jnpf.onlinedev.model.ExcelImFieldModel;
import jnpf.onlinedev.model.OnlineImport.ImportDataModel;
import jnpf.onlinedev.model.OnlineImport.ImportFormCheckUniqueModel;
import jnpf.onlinedev.model.OnlineImport.ExcelImportModel;
import jnpf.onlinedev.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* space
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-23
*/
@Slf4j
@RestController
@Tag(name = "space" , description = "example")
@RequestMapping("/api/example/Space")
public class SpaceController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private SpaceService spaceService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param spacePagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody SpacePagination spacePagination)throws IOException{
List<SpaceEntity> list= spaceService.getList(spacePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SpaceEntity entity : list) {
Map<String, Object> spaceMap=JsonUtil.entityToMap(entity);
spaceMap.put("id", spaceMap.get("id"));
//副表数据
//子表数据
realList.add(spaceMap);
}
//数据转换
// realList = generaterSwapUtil.swapDataList(realList, SpaceConstant.getFormData(), SpaceConstant.getColumnData(), spacePagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(spacePagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param spaceForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid SpaceForm spaceForm) {
String b = spaceService.checkForm(spaceForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
spaceService.saveOrUpdate(spaceForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody SpacePagination spacePagination) throws IOException {
if (StringUtil.isEmpty(spacePagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<SpaceEntity> list= spaceService.getList(spacePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (SpaceEntity entity : list) {
Map<String, Object> spaceMap=JsonUtil.entityToMap(entity);
spaceMap.put("id", spaceMap.get("id"));
//副表数据
//子表数据
realList.add(spaceMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, SpaceConstant.getFormData(), SpaceConstant.getColumnData(), spacePagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(spacePagination.getSelectKey())?spacePagination.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 "name" :
entitys.add(new ExcelExportEntity("空间名称" ,"name"));
break;
case "spaceArea" :
entitys.add(new ExcelExportEntity("空间面积" ,"spaceArea"));
break;
case "spaceType" :
entitys.add(new ExcelExportEntity("空间类型" ,"spaceType"));
break;
case "unitPrice" :
entitys.add(new ExcelExportEntity("单价" ,"unitPrice"));
break;
case "state" :
entitys.add(new ExcelExportEntity("状态" ,"state"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "type" :
entitys.add(new ExcelExportEntity("类型" ,"type"));
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(SpaceConstant.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("空间面积" ,"spaceArea"));
entitys.add(new ExcelExportEntity("空间类型" ,"spaceType"));
entitys.add(new ExcelExportEntity("状态" ,"state"));
entitys.add(new ExcelExportEntity("单价" ,"unitPrice"));
entitys.add(new ExcelExportEntity("区域名称" ,"pid"));
entitys.add(new ExcelExportEntity("空间编码" ,"code"));
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(SpaceConstant.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<SpaceExcelVO> excelDataList = ExcelImportUtil.importExcel(temporary, SpaceExcelVO.class, params);
// 导入字段
List<ExcelImFieldModel> columns = new ArrayList<>();
columns.add(new ExcelImFieldModel("spaceArea","空间面积"));
columns.add(new ExcelImFieldModel("spaceType","空间类型"));
columns.add(new ExcelImFieldModel("state","状态"));
columns.add(new ExcelImFieldModel("unitPrice","单价"));
columns.add(new ExcelImFieldModel("pid","区域名称"));
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){
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(SpaceConstant.DBLINKID);
uniqueModel.setUpdate(Objects.equals("2", "2"));
ExcelImportModel excelImportModel = generaterSwapUtil.importData(SpaceConstant.getFormData(),listData,uniqueModel,
SpaceConstant.TABLEFIELDKEY,SpaceConstant.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,SpaceForm.class), true);
}else {
create( JsonUtil.getJsonToBean(result,SpaceForm.class));
}
}
return ActionResult.success(excelImportModel);
}
/**
*
*
* @return
*/
@Operation(summary = "导出异常报告")
@PostMapping("/ImportExceptionData")
public ActionResult<DownloadVO> ImportExceptionData(@RequestBody VisualImportModel visualImportModel) {
DownloadVO vo=DownloadVO.builder().build();
List<SpaceExcelErrorVO> spaceVOList = JsonUtil.getJsonToList(visualImportModel.getList(), SpaceExcelErrorVO.class);
UserInfo userInfo = userProvider.get();
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams(null, "错误报告");
exportParams.setType(ExcelType.XSSF);
workbook = ExcelExportUtil.exportExcel(exportParams,
SpaceExcelErrorVO.class, spaceVOList);
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 spaceForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid SpaceForm spaceForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
spaceForm.setId(id);
if (!isImport) {
String b = spaceService.checkForm(spaceForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
SpaceEntity entity= spaceService.getInfo(id);
if(entity!=null){
try{
spaceService.saveOrUpdate(spaceForm,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){
SpaceEntity entity= spaceService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
spaceService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
SpaceEntity entity= spaceService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> spaceMap=JsonUtil.entityToMap(entity);
spaceMap.put("id", spaceMap.get("id"));
//副表数据
//子表数据
spaceMap = generaterSwapUtil.swapDataDetail(spaceMap,SpaceConstant.getFormData(),"582541735268188933",false);
return ActionResult.success(spaceMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
SpaceEntity entity= spaceService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> spaceMap=JsonUtil.entityToMap(entity);
spaceMap.put("id", spaceMap.get("id"));
//副表数据
//子表数据
spaceMap = generaterSwapUtil.swapDataForm(spaceMap,SpaceConstant.getFormData(),SpaceConstant.TABLEFIELDKEY,SpaceConstant.TABLERENAMES);
return ActionResult.success(spaceMap);
}
}

@ -0,0 +1,83 @@
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-23
*/
@Data
@TableName("yq_park_area_space")
public class SpaceEntity {
@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("DESCRIPTION")
private String description;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type;
@TableField("SPACE_NUM")
private BigDecimal spaceNum;
@TableField(value = "SPACE_AREA" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal spaceArea;
@TableField(value = "SPACE_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String spaceType;
@TableField(value = "STATE" , updateStrategy = FieldStrategy.IGNORED)
private String state;
@TableField(value = "UNIT_PRICE" , updateStrategy = FieldStrategy.IGNORED)
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;
@TableField(exist = false)
private String areaName;
@TableField(exist = false)
private String state1;
@TableField(exist = false)
private String spaceType1;
}

@ -38,4 +38,7 @@ public class AreaForm {
/** 备注 **/ /** 备注 **/
@JsonProperty("remark") @JsonProperty("remark")
private String remark; private String remark;
/** 类型 **/
@JsonProperty("type")
private Object type;
} }

@ -36,4 +36,7 @@ public class AreaPagination extends Pagination {
/** type */ /** type */
@JsonProperty("type") @JsonProperty("type")
private String type; private String type;
/** 园区名称 */
@JsonProperty("parkName")
private String parkName;
} }

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

@ -0,0 +1,61 @@
package jnpf.model.space;
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;
/**
*
* space
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-23
*/
@Data
public class SpaceExcelVO{
/** 空间面积 **/
@JSONField(name = "spaceArea")
@Excel(name = "空间面积",orderNum = "1", isImportField = "true" )
private Integer spaceArea;
/** 空间类型 **/
@JSONField(name = "spaceType")
@Excel(name = "空间类型",orderNum = "1", isImportField = "true" )
private String spaceType;
/** 状态 **/
@JSONField(name = "state")
@Excel(name = "状态",orderNum = "1", isImportField = "true" )
private String state;
/** 单价 **/
@JSONField(name = "unitPrice")
@Excel(name = "单价",orderNum = "1", isImportField = "true" )
private Integer unitPrice;
/** 区域名称 **/
@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 = "name")
@Excel(name = "空间名称",orderNum = "1", isImportField = "true" )
private String name;
}

@ -0,0 +1,50 @@
package jnpf.model.space;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* space
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-23
*/
@Data
public class SpaceForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 区域名称 **/
@JsonProperty("pid")
private String pid;
/** 空间编码 **/
@JsonProperty("code")
private String code;
/** 空间名称 **/
@JsonProperty("name")
private String name;
/** 空间面积 **/
@JsonProperty("spaceArea")
private BigDecimal spaceArea;
/** 空间类型 **/
@JsonProperty("spaceType")
private Object spaceType;
/** 单价 **/
@JsonProperty("unitPrice")
private BigDecimal unitPrice;
/** 状态 **/
@JsonProperty("state")
private Object state;
/** 备注 **/
@JsonProperty("remark")
private String remark;
/** 类型 **/
@JsonProperty("type")
private Object type;
}

@ -0,0 +1,42 @@
package jnpf.model.space;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* space
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-23
*/
@Data
public class SpacePagination 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;
/** 类型 */
@JsonProperty("type")
private String type;
/** 区域名称 */
@JsonProperty("areaName")
private String areaName;
}

@ -17,11 +17,11 @@
label-position="right" label-position="right"
> >
<template v-if="!loading"> <template v-if="!loading">
<el-col :span="24"> <!-- <el-col :span="24">
<jnpf-form-tip-item label="园区名称" prop="pid"> <jnpf-form-tip-item label="园区名称" prop="pid">
<p>{{ dataForm.pid }}</p> <p>{{ dataForm.pid }}</p>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col> -->
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="区域编码" prop="code"> <jnpf-form-tip-item label="区域编码" prop="code">
<p>{{ dataForm.code }}</p> <p>{{ dataForm.code }}</p>

@ -19,7 +19,7 @@
> >
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="24"> <!-- <el-col :span="24">
<jnpf-form-tip-item label="园区名称" prop="pid"> <jnpf-form-tip-item label="园区名称" prop="pid">
<JnpfInput <JnpfInput
v-model="dataForm.pid" v-model="dataForm.pid"
@ -30,7 +30,7 @@
> >
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col> -->
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="区域编码" prop="code"> <jnpf-form-tip-item label="区域编码" prop="code">
<JnpfInput <JnpfInput
@ -175,6 +175,7 @@ export default {
name: undefined, name: undefined,
description: undefined, description: undefined,
remark: undefined, remark: undefined,
type: "2",
version: 0 version: 0
}, },
tableRequiredData: {}, tableRequiredData: {},
@ -311,7 +312,7 @@ export default {
clearData() { clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)); this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
}, },
init(id, isDetail, allList) { init(id, isDetail, allList, treeActiveId) {
this.prevDis = false; this.prevDis = false;
this.nextDis = false; this.nextDis = false;
this.allList = allList || []; this.allList = allList || [];
@ -342,6 +343,7 @@ export default {
} else { } else {
this.clearData(); this.clearData();
this.initDefaultData(); this.initDefaultData();
this.dataForm.pid = treeActiveId;
} }
}); });
this.$store.commit("generator/UPDATE_RELATION_DATA", {}); this.$store.commit("generator/UPDATE_RELATION_DATA", {});

@ -46,6 +46,12 @@
<div class="JNPF-common-layout-center"> <div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16"> <el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="园区名称">
<el-input v-model="query.parkName" placeholder="请输入" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="区域名称"> <el-form-item label="区域名称">
<el-input v-model="query.name" placeholder="请输入" clearable> <el-input v-model="query.name" placeholder="请输入" clearable>
@ -227,8 +233,10 @@ export default {
uploadBoxVisible: false, uploadBoxVisible: false,
detailVisible: false, detailVisible: false,
query: { query: {
parkName: undefined,
name: undefined, name: undefined,
type: undefined type: undefined,
pid: undefined
}, },
treeProps: { treeProps: {
children: "children", children: "children",
@ -237,7 +245,7 @@ export default {
isLeaf: "isLeaf" isLeaf: "isLeaf"
}, },
list: [], list: [],
listLoading: true, listLoading: false,
multipleSelection: [], multipleSelection: [],
total: 0, total: 0,
queryData: {}, queryData: {},
@ -467,7 +475,7 @@ export default {
}, },
async initSearchDataAndListData() { async initSearchDataAndListData() {
await this.initSearchData(); await this.initSearchData();
this.initData(); // this.initData();
}, },
// //
async initSearchData() {}, async initSearchData() {},
@ -567,10 +575,18 @@ export default {
this.initData(); this.initData();
}, },
addOrUpdateHandle(row, isDetail) { addOrUpdateHandle(row, isDetail) {
if (!row && this.query.type != "1") {
this.$message({
type: "error",
message: "请选择园区信息",
duration: 1500
});
return;
}
let id = row ? row.id : ""; let id = row ? row.id : "";
this.formVisible = true; this.formVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list); this.$refs.JNPFForm.init(id, isDetail, this.list, this.treeActiveId);
}); });
}, },
exportData() { exportData() {

@ -1,80 +1,123 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'" <el-dialog
:close-on-click-modal="false" append-to-body :title="!dataForm.id ? '新建' : '编辑'"
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll :close-on-click-modal="false"
width="800px"> append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="800px"
>
<el-row :gutter="15" class=""> <el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" > <el-form
ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="100px"
label-position="right"
>
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="园区编码" prop="code">
label="园区编码" prop="code" > <JnpfInput
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)" v-model="dataForm.code"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('code', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="园区名称" prop="name">
label="园区名称" prop="name" > <JnpfInput
<JnpfInput v-model="dataForm.name" @change="changeData('name',-1)" v-model="dataForm.name"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('name', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item <jnpf-form-tip-item label="园区描述" prop="description">
label="园区描述" prop="description" > <JnpfInput
<JnpfInput v-model="dataForm.description" @change="changeData('description',-1)" v-model="dataForm.description"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('description', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item <jnpf-form-tip-item label="备注" prop="remark">
label="备注" prop="remark" > <JnpfInput
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)" v-model="dataForm.remark"
placeholder="请输入" clearable :style='{"width":"100%"}'> @change="changeData('remark', -1)"
placeholder="请输入"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" <SelectDialog
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/> v-if="selectDialogVisible"
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row> </el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id"> <div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'> <el-button @click="prev" :disabled="prevDis">
{{'上一条'}} {{ "上一条" }}
</el-button> </el-button>
<el-button @click="next" :disabled='nextDis'> <el-button @click="next" :disabled="nextDis">
{{'下一条'}} {{ "下一条" }}
</el-button> </el-button>
</div> </div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading"> <el-button
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-button> type="primary"
@click="dataFormSubmit(2)"
:loading="continueBtnLoading"
>
{{ !dataForm.id ? "确定并新增" : "确定并继续" }}</el-button
>
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button> <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">
</el-button
>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import request from '@/utils/request' import request from "@/utils/request";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface' import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from '@/api/permission/user' import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize' import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js' import {
import { thousandsFormat } from "@/components/Generator/utils/index" getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
export default { export default {
components: {}, components: {},
props: [], props: [],
@ -89,20 +132,17 @@
visible: false, visible: false,
loading: false, loading: false,
btnLoading: false, btnLoading: false,
formRef: 'formRef', formRef: "formRef",
setting: {}, setting: {},
eventType: '', eventType: "",
userBoxVisible: false, userBoxVisible: false,
selectDialogVisible: false, selectDialogVisible: false,
currTableConf: {}, currTableConf: {},
dataValueAll: {}, dataValueAll: {},
addTableConf:{ addTableConf: {},
},
// //
ableAll:{ ableAll: {},
}, tableRows: {},
tableRows:{
},
Vmodel: "", Vmodel: "",
currVmodel: "", currVmodel: "",
dataForm: { dataForm: {
@ -111,28 +151,31 @@
description: undefined, description: undefined,
remark: undefined, remark: undefined,
type: "1", type: "1",
version: 0, version: 0
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: dataRule: {
{
code: [ code: [
{ {
required: true, required: true,
message: '请输入', message: "请输入",
trigger: 'blur' trigger: "blur"
}, }
], ],
name: [ name: [
{ {
required: true, required: true,
message: '请输入', message: "请输入",
trigger: 'blur' trigger: "blur"
}
]
}, },
typeOptions: [
{ fullName: "园区", id: "1" },
{ fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
], ],
}, typeProps: { label: "fullName", value: "id" },
typeOptions:[{"fullName":"园区","id":"1"},{"fullName":"区域","id":"2"},{"fullName":"空间","id":"3"}],
typeProps:{"label":"fullName","value":"id" },
childIndex: -1, childIndex: -1,
isEdit: false, isEdit: false,
interfaceRes: { interfaceRes: {
@ -140,62 +183,62 @@
name: [], name: [],
description: [], description: [],
remark: [], remark: [],
type:[] , type: []
},
} }
};
}, },
computed: { computed: {
...mapGetters(['userInfo']) ...mapGetters(["userInfo"])
}, },
watch: {}, watch: {},
created() { created() {
this.dataAll() this.dataAll();
this.initDefaultData() this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)) this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
}, },
mounted() {}, mounted() {},
methods: { methods: {
prev() { prev() {
this.index-- this.index--;
if (this.index === 0) { if (this.index === 0) {
this.prevDis = true this.prevDis = true;
} }
this.nextDis = false this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
next() { next() {
this.index++ this.index++;
if (this.index === this.allList.length - 1) { if (this.index === this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
this.prevDis = false this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
getInfo(id) { getInfo(id) {
request({ request({
url: '/api/example/Park/'+ id, url: "/api/example/Park/" + id,
method: 'get' method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data) this.dataInfo(res.data);
}); });
}, },
goBack() { goBack() {
this.visible = false this.visible = false;
this.$emit('refreshDataList', true) this.$emit("refreshDataList", true);
}, },
changeData(model, index) { changeData(model, index) {
this.isEdit = false this.isEdit = false;
this.childIndex = index this.childIndex = index;
let modelAll = model.split("-"); let modelAll = model.split("-");
let faceMode = ""; let faceMode = "";
for (let i = 0; i < modelAll.length; i++) { for (let i = 0; i < modelAll.length; i++) {
@ -203,14 +246,14 @@
} }
for (let key in this.interfaceRes) { for (let key in this.interfaceRes) {
if (key != faceMode) { if (key != faceMode) {
let faceReList = this.interfaceRes[key] let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) { for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) { if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options'; let options = "get" + key + "Options";
if (this[options]) { if (this[options]) {
this[options]() this[options]();
} }
this.changeData(key, index) this.changeData(key, index);
} }
} }
} }
@ -221,202 +264,204 @@
if (type == 2) { if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) { for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) { if (index == -1) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} else if (index == i) { } else if (index == i) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} }
} }
} else { } else {
this.dataForm[data] = defaultValue this.dataForm[data] = defaultValue;
} }
} }
}, },
dataAll(){ dataAll() {},
},
clearData() { clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)) this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
}, },
init(id, isDetail, allList) { init(id, isDetail, allList) {
this.prevDis = false this.prevDis = false;
this.nextDis = false this.nextDis = false;
this.allList = allList || [] this.allList = allList || [];
if (allList.length) { if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id) this.index = this.allList.findIndex(item => item.id === id);
if (this.index == 0) { if (this.index == 0) {
this.prevDis = true this.prevDis = true;
} }
if (this.index == this.allList.length - 1) { if (this.index == this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
} else { } else {
this.prevDis = true this.prevDis = true;
this.nextDis = true this.nextDis = true;
} }
this.dataForm.id = id || 0; this.dataForm.id = id || 0;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.loading = true this.loading = true;
request({ request({
url: '/api/example/Park/'+this.dataForm.id, url: "/api/example/Park/" + this.dataForm.id,
method: 'get' method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data) this.dataInfo(res.data);
this.loading = false this.loading = false;
}); });
} else { } else {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
} }
}); });
this.$store.commit('generator/UPDATE_RELATION_DATA', {}) this.$store.commit("generator/UPDATE_RELATION_DATA", {});
}, },
// //
initDefaultData() { initDefaultData() {},
},
// //
dataFormSubmit(type) { dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0 this.dataFormSubmitType = type ? type : 0;
this.$refs['formRef'].validate((valid) => { this.$refs["formRef"].validate(valid => {
if (valid) { if (valid) {
this.request() this.request();
} }
}) });
}, },
request() { request() {
let _data =this.dataList() let _data = this.dataList();
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true this.continueBtnLoading = true;
} else { } else {
this.btnLoading = true this.btnLoading = true;
} }
if (!this.dataForm.id) { if (!this.dataForm.id) {
request({ request({
url: '/api/example/Park', url: "/api/example/Park",
method: 'post', method: "post",
data: _data data: _data
}).then((res) => { })
.then(res => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
}) });
this.continueBtnLoading = false this.continueBtnLoading = false;
return return;
} }
this.visible = false this.visible = false;
this.btnLoading = false this.btnLoading = false;
this.$emit('refresh', true) this.$emit("refresh", true);
} }
});
}) })
}).catch(()=>{ .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
} else { } else {
request({ request({
url: '/api/example/Park/'+this.dataForm.id, url: "/api/example/Park/" + this.dataForm.id,
method: 'PUT', method: "PUT",
data: _data data: _data
}).then((res) => { })
.then(res => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false if (this.dataFormSubmitType == 2)
this.visible = false return (this.continueBtnLoading = false);
this.btnLoading = false this.visible = false;
this.$emit('refresh', true) this.btnLoading = false;
this.$emit("refresh", true);
} }
});
}) })
}).catch(()=>{ .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
} }
}, },
openSelectDialog(key) { openSelectDialog(key) {
this.currTableConf=this.addTableConf[key] this.currTableConf = this.addTableConf[key];
this.currVmodel=key this.currVmodel = key;
this.selectDialogVisible = true this.selectDialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectDialog.init() this.$refs.selectDialog.init();
}) });
}, },
addForSelect(data) { addForSelect(data) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let t = data[i] let t = data[i];
if(this['get'+this.currVmodel]){ if (this["get" + this.currVmodel]) {
this['get'+this.currVmodel](t) this["get" + this.currVmodel](t);
} }
} }
}, },
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) { dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null; let timeDataValue = null;
let timeValue = Number(timeValueData) let timeValue = Number(timeValueData);
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue timeDataValue = timeValue;
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = new Date().getTime() timeDataValue = new Date().getTime();
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue) previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime() timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
} }
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getLaterData(timeValue) previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime() timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
} }
} }
} }
return timeDataValue; return timeDataValue;
}, },
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) { time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null let timeDataValue = null;
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue || '00:00:00' timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(':').length == 3) { if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue timeDataValue = timeDataValue;
} else { } else {
timeDataValue = timeDataValue + ':00' timeDataValue = timeDataValue + ":00";
} }
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format) timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue) previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue) previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} }
} }
return timeDataValue; return timeDataValue;
@ -426,13 +471,12 @@
return _data; return _data;
}, },
dataInfo(dataAll) { dataInfo(dataAll) {
let _dataAll =dataAll let _dataAll = dataAll;
this.dataForm = _dataAll this.dataForm = _dataAll;
this.isEdit = true this.isEdit = true;
this.dataAll() this.dataAll();
this.childIndex=-1 this.childIndex = -1;
},
},
} }
}
};
</script> </script>

@ -186,7 +186,7 @@ export default {
isLeaf: "isLeaf" isLeaf: "isLeaf"
}, },
list: [], list: [],
listLoading: true, listLoading: false,
multipleSelection: [], multipleSelection: [],
total: 0, total: 0,
queryData: {}, queryData: {},
@ -383,7 +383,7 @@ export default {
}, },
async initSearchDataAndListData() { async initSearchDataAndListData() {
await this.initSearchData(); await this.initSearchData();
this.initData(); // this.initData();
}, },
// //
async initSearchData() {}, async initSearchData() {},

@ -0,0 +1,171 @@
<template>
<el-dialog
title="详情"
:close-on-click-modal="false"
append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="1000px"
>
<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="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="name">
<p>{{ dataForm.name }}</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>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from "@/utils/request";
import { getConfigData } from "@/api/onlineDev/visualDev";
import jnpf from "@/utils/jnpf";
import Detail from "@/views/basic/dynamicModel/list/detail";
import { thousandsFormat } from "@/components/Generator/utils/index";
export default {
components: { Detail },
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id: "",
pid: "",
code: "",
name: "",
spaceArea: "",
spaceType: "",
unitPrice: "",
state: "10",
remark: "",
type: "3"
},
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" },
typeOptions: [
{ fullName: "园区", id: "1" },
{ fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
],
typeProps: { label: "fullName", value: "id" }
};
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return;
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return;
let formData = JSON.parse(res.data.formData);
formData.popupType = "general";
this.detailVisible = true;
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue);
});
});
},
dataInfo(dataAll) {
let _dataAll = dataAll;
this.dataForm = _dataAll;
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true;
request({
url: "/api/example/Space/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,53 +1,14 @@
<template> <template>
<transition name="el-zoom-in-center"> <el-dialog
<div class="JNPF-preview-main"> :title="!dataForm.id ? '新建' : '编辑'"
<div class="JNPF-common-page-header"> :close-on-click-modal="false"
<el-page-header append-to-body
@back="goBack" :visible.sync="visible"
:content="!dataForm.id ? '新建' : '编辑'" class="JNPF-dialog JNPF-dialog_center"
/> lock-scroll
<div class="options"> width="1000px"
<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-row :gutter="15" class="">
<el-form <el-form
ref="formRef" ref="formRef"
:model="dataForm" :model="dataForm"
@ -58,35 +19,23 @@
> >
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="12"> <!-- <el-col :span="24">
<jnpf-form-tip-item label="区域名称" prop="regionId"> <jnpf-form-tip-item label="区域名称" prop="pid">
<JnpfPopupSelect <JnpfInput
v-model="dataForm.regionId" v-model="dataForm.areaName"
@change="changeData('regionId', -1)" @change="changeData('pid', -1)"
:rowIndex="null" placeholder="请输入"
: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 clearable
:style="{ width: '100%' }" :style="{ width: '100%' }"
> >
</JnpfPopupSelect> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col> -->
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="空间编码" prop="spaceCode"> <jnpf-form-tip-item label="空间编码" prop="code">
<JnpfInput <JnpfInput
v-model="dataForm.spaceCode" v-model="dataForm.code"
@change="changeData('spaceCode', -1)" @change="changeData('code', -1)"
placeholder="请输入" placeholder="请输入"
clearable clearable
:style="{ width: '100%' }" :style="{ width: '100%' }"
@ -95,10 +44,10 @@
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<jnpf-form-tip-item label="空间名称" prop="spaceName"> <jnpf-form-tip-item label="空间名称" prop="name">
<JnpfInput <JnpfInput
v-model="dataForm.spaceName" v-model="dataForm.name"
@change="changeData('spaceName', -1)" @change="changeData('name', -1)"
placeholder="请输入" placeholder="请输入"
clearable clearable
:style="{ width: '100%' }" :style="{ width: '100%' }"
@ -182,8 +131,28 @@
@close="selectDialogVisible = false" @close="selectDialogVisible = false"
/> />
</el-row> </el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled="prevDis">
{{ "上一条" }}
</el-button>
<el-button @click="next" :disabled="nextDis">
{{ "下一条" }}
</el-button>
</div> </div>
</transition> <el-button
type="primary"
@click="dataFormSubmit(2)"
:loading="continueBtnLoading"
>
{{ !dataForm.id ? "确定并新增" : "确定并继续" }}</el-button
>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">
</el-button
>
</span>
</el-dialog>
</template> </template>
<script> <script>
@ -229,33 +198,34 @@ export default {
Vmodel: "", Vmodel: "",
currVmodel: "", currVmodel: "",
dataForm: { dataForm: {
regionId: undefined, pid: undefined,
spaceCode: undefined, code: undefined,
spaceName: undefined, name: undefined,
spaceArea: undefined, spaceArea: undefined,
spaceType: undefined, spaceType: undefined,
unitPrice: undefined, unitPrice: undefined,
state: "10", state: "10",
remark: undefined, remark: undefined,
type: "3",
version: 0 version: 0
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: { dataRule: {
regionId: [ pid: [
{ {
required: true, required: true,
message: "请选择", message: "请输入",
trigger: "change" trigger: "blur"
} }
], ],
spaceCode: [ code: [
{ {
required: true, required: true,
message: "请输入", message: "请输入",
trigger: "blur" trigger: "blur"
} }
], ],
spaceName: [ name: [
{ {
required: true, required: true,
message: "请输入", message: "请输入",
@ -277,11 +247,6 @@ export default {
} }
] ]
}, },
regionIdcolumnOptions: [
{ label: "区域编码", value: "region_number" },
{ label: "区域名称", value: "region_name" },
{ label: "空间数量", value: "spaces_number" }
],
spaceTypeOptions: [ spaceTypeOptions: [
{ fullName: "办公室", id: "10" }, { fullName: "办公室", id: "10" },
{ fullName: "加工车间", id: "20" } { fullName: "加工车间", id: "20" }
@ -294,17 +259,24 @@ export default {
{ fullName: "预约", id: "40" } { fullName: "预约", id: "40" }
], ],
stateProps: { label: "fullName", value: "id" }, stateProps: { label: "fullName", value: "id" },
typeOptions: [
{ fullName: "园区", id: "1" },
{ fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
],
typeProps: { label: "fullName", value: "id" },
childIndex: -1, childIndex: -1,
isEdit: false, isEdit: false,
interfaceRes: { interfaceRes: {
regionId: [], pid: [],
spaceCode: [], code: [],
spaceName: [], name: [],
spaceArea: [], spaceArea: [],
spaceType: [], spaceType: [],
unitPrice: [], unitPrice: [],
state: [], state: [],
remark: [] remark: [],
type: []
} }
}; };
}, },
@ -347,7 +319,7 @@ export default {
}, },
getInfo(id) { getInfo(id) {
request({ request({
url: "/api/example/Spatial/" + id, url: "/api/example/Space/" + id,
method: "get" method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data); this.dataInfo(res.data);
@ -396,13 +368,10 @@ export default {
} }
}, },
dataAll() {}, dataAll() {},
goBack() {
this.$emit("refresh");
},
clearData() { clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)); this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
}, },
init(id, isDetail, allList) { init(id, isDetail, allList, treeActiveId) {
this.prevDis = false; this.prevDis = false;
this.nextDis = false; this.nextDis = false;
this.allList = allList || []; this.allList = allList || [];
@ -424,7 +393,7 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
this.loading = true; this.loading = true;
request({ request({
url: "/api/example/Spatial/" + this.dataForm.id, url: "/api/example/Space/" + this.dataForm.id,
method: "get" method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data); this.dataInfo(res.data);
@ -433,6 +402,7 @@ export default {
} else { } else {
this.clearData(); this.clearData();
this.initDefaultData(); this.initDefaultData();
this.dataForm.pid = treeActiveId;
} }
}); });
this.$store.commit("generator/UPDATE_RELATION_DATA", {}); this.$store.commit("generator/UPDATE_RELATION_DATA", {});
@ -457,7 +427,7 @@ export default {
} }
if (!this.dataForm.id) { if (!this.dataForm.id) {
request({ request({
url: "/api/example/Spatial", url: "/api/example/Space",
method: "post", method: "post",
data: _data data: _data
}) })
@ -487,7 +457,7 @@ export default {
}); });
} else { } else {
request({ request({
url: "/api/example/Spatial/" + this.dataForm.id, url: "/api/example/Space/" + this.dataForm.id,
method: "PUT", method: "PUT",
data: _data data: _data
}) })

@ -1,15 +1,60 @@
<template> <template>
<div class="JNPF-common-layout"> <div class="JNPF-common-layout">
<div class="JNPF-common-layout-left">
<div class="JNPF-common-title">
<h2>{{ this.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"> <div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16"> <el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent> <el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="区域名称">
<el-input v-model="query.areaName" placeholder="请输入" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="空间名称"> <el-form-item label="空间名称">
<el-input <el-input v-model="query.name" placeholder="请输入" clearable>
v-model="query.spaceName"
placeholder="请输入"
clearable
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -82,20 +127,25 @@
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
:span-method="arraySpanMethod" :span-method="arraySpanMethod"
> >
<el-table-column prop="regionId" label="区域名称" align="left"> <el-table-column prop="areaName" label="区域名称" align="left">
</el-table-column> </el-table-column>
<el-table-column prop="spaceCode" label="空间编码" align="left"> <el-table-column label="状态" prop="state1" algin="left">
<template slot-scope="scope">
{{ scope.row.state1 }}
</template>
</el-table-column>
<el-table-column prop="code" label="空间编码" align="left">
</el-table-column> </el-table-column>
<el-table-column prop="spaceName" label="空间名称" align="left"> <el-table-column prop="name" label="空间名称" align="left">
</el-table-column> </el-table-column>
<el-table-column prop="spaceArea" label="空间面积" align="left"> <el-table-column prop="spaceArea" label="空间面积" align="left">
<template slot-scope="scope" v-if="scope.row.spaceArea"> <template slot-scope="scope" v-if="scope.row.spaceArea">
<JnpfNumber v-model="scope.row.spaceArea" :thousands="false" /> <JnpfNumber v-model="scope.row.spaceArea" :thousands="false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="空间类型" prop="spaceType" algin="left"> <el-table-column label="空间类型" prop="spaceType1" algin="left">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.spaceType }} {{ scope.row.spaceType1 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="unitPrice" label="单价" align="left"> <el-table-column prop="unitPrice" label="单价" align="left">
@ -103,11 +153,6 @@
<JnpfNumber v-model="scope.row.unitPrice" :thousands="false" /> <JnpfNumber v-model="scope.row.unitPrice" :thousands="false" />
</template> </template>
</el-table-column> </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 prop="remark" label="备注" align="left">
</el-table-column> </el-table-column>
<el-table-column label="操作" fixed="right" width="150"> <el-table-column label="操作" fixed="right" width="150">
@ -185,6 +230,7 @@ export default {
}, },
data() { data() {
return { return {
title: "",
keyword: "", keyword: "",
expandsTree: true, expandsTree: true,
refreshTree: true, refreshTree: true,
@ -200,16 +246,19 @@ export default {
uploadBoxVisible: false, uploadBoxVisible: false,
detailVisible: false, detailVisible: false,
query: { query: {
spaceName: undefined areaName: undefined,
name: undefined,
type: undefined,
pid: undefined
}, },
treeProps: { treeProps: {
children: "children", children: "children",
label: "fullName", label: "name",
value: "id", value: "id",
isLeaf: "isLeaf" isLeaf: "isLeaf"
}, },
list: [], list: [],
listLoading: true, listLoading: false,
multipleSelection: [], multipleSelection: [],
total: 0, total: 0,
queryData: {}, queryData: {},
@ -225,6 +274,8 @@ export default {
flowListVisible: false, flowListVisible: false,
flowList: [], flowList: [],
exportBoxVisible: false, exportBoxVisible: false,
treeData: [],
treeActiveId: "",
spaceTypeOptions: [ spaceTypeOptions: [
{ fullName: "办公室", id: "10" }, { fullName: "办公室", id: "10" },
{ fullName: "加工车间", id: "20" } { fullName: "加工车间", id: "20" }
@ -237,11 +288,20 @@ export default {
{ fullName: "预约", id: "40" } { fullName: "预约", id: "40" }
], ],
stateProps: { label: "fullName", value: "id" }, stateProps: { label: "fullName", value: "id" },
interfaceRes: { typeOptions: [
regionId: [] { fullName: "园区", id: "1" },
} { fullName: "区域", id: "2" },
{ fullName: "空间", id: "3" }
],
typeProps: { label: "fullName", value: "id" },
interfaceRes: {}
}; };
}, },
watch: {
keyword(val) {
this.$refs.treeBox.filter(val);
}
},
computed: { computed: {
...mapGetters(["userInfo"]), ...mapGetters(["userInfo"]),
menuId() { menuId() {
@ -249,7 +309,7 @@ export default {
} }
}, },
created() { created() {
this.getColumnList(), this.initSearchDataAndListData(); this.getColumnList(), this.getTreeView();
this.queryData = JSON.parse(JSON.stringify(this.query)); this.queryData = JSON.parse(JSON.stringify(this.query));
}, },
methods: { methods: {
@ -412,9 +472,49 @@ export default {
this.listQuery.sidx = !order ? "" : prop; this.listQuery.sidx = !order ? "" : prop;
this.initData(); this.initData();
}, },
getTreeView() {
getDataInterfaceRes("585466623440193285").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) {
if (data.type == "1") {
this.$message({
type: "error",
message: "请选择区域或者空间",
duration: 1500
});
return;
}
this.title = data.name;
this.treeActiveId = data.id;
for (let key in this.query) {
this.query[key] = undefined;
}
this.query.pid = data.id;
this.query.type = data.type;
this.listQuery = {
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: ""
};
this.initData();
},
async initSearchDataAndListData() { async initSearchDataAndListData() {
await this.initSearchData(); await this.initSearchData();
this.initData(); // this.initData();
}, },
// //
async initSearchData() {}, async initSearchData() {},
@ -426,11 +526,11 @@ export default {
keyword: this.keyword, keyword: this.keyword,
dataType: 0, dataType: 0,
menuId: this.menuId, menuId: this.menuId,
moduleId: "582541735268188933", moduleId: "582541735268188933"
type: 1 // type: 2
}; };
request({ request({
url: `/api/example/Spatial/getList`, url: `/api/example/Space/getList`,
method: "post", method: "post",
data: _query data: _query
}).then(res => { }).then(res => {
@ -449,7 +549,7 @@ export default {
}) })
.then(() => { .then(() => {
request({ request({
url: `/api/example/Spatial/${id}`, url: `/api/example/Space/${id}`,
method: "DELETE" method: "DELETE"
}).then(res => { }).then(res => {
this.$message({ this.$message({
@ -466,7 +566,7 @@ export default {
handelUpload() { handelUpload() {
this.uploadBoxVisible = true; this.uploadBoxVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.UploadBox.init("", "example/Spatial"); this.$refs.UploadBox.init("", "example/Space");
}); });
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
@ -488,7 +588,7 @@ export default {
}) })
.then(() => { .then(() => {
request({ request({
url: `/api/example/Spatial/batchRemove`, url: `/api/example/Space/batchRemove`,
data: ids, data: ids,
method: "DELETE" method: "DELETE"
}).then(res => { }).then(res => {
@ -515,10 +615,18 @@ export default {
this.initData(); this.initData();
}, },
addOrUpdateHandle(row, isDetail) { addOrUpdateHandle(row, isDetail) {
if (!row && this.query.type != "2") {
this.$message({
type: "error",
message: "请选择区域信息",
duration: 1500
});
return;
}
let id = row ? row.id : ""; let id = row ? row.id : "";
this.formVisible = true; this.formVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list); this.$refs.JNPFForm.init(id, isDetail, this.list, this.treeActiveId);
}); });
}, },
exportData() { exportData() {
@ -535,7 +643,7 @@ export default {
menuId: this.menuId menuId: this.menuId
}; };
request({ request({
url: `/api/example/Spatial/Actions/Export`, url: `/api/example/Space/Actions/Export`,
method: "post", method: "post",
data: query data: query
}).then(res => { }).then(res => {

File diff suppressed because one or more lines are too long

@ -1,156 +0,0 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
content="详情"/>
<div class="options">
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="formRef" :model="dataForm" size="small" label-width="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

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