feat(contract):装修申请、场地预约前后端代码提交;

master
jiyufei 3 months ago
parent 1f7291f950
commit 42b2a45093

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

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

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

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

@ -0,0 +1,373 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.DecorationApplicationFormMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.decorationapplicationform.*;
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.time.LocalDate;
import java.time.format.DateTimeFormatter;
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;
/**
* DecorationApplicationForm
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
@Service
public class DecorationApplicationFormServiceImpl extends ServiceImpl<DecorationApplicationFormMapper, DecorationApplicationFormEntity> implements DecorationApplicationFormService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<DecorationApplicationFormEntity> getList(DecorationApplicationFormPagination decorationApplicationFormPagination) {
return getTypeList(decorationApplicationFormPagination, decorationApplicationFormPagination.getDataType());
}
/**
*
*/
@Override
public List<DecorationApplicationFormEntity> getTypeList(DecorationApplicationFormPagination decorationApplicationFormPagination, 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 ? DecorationApplicationFormConstant.getAppColumnData() : DecorationApplicationFormConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int decorationApplicationFormNum = 0;
QueryWrapper<DecorationApplicationFormEntity> decorationApplicationFormQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = decorationApplicationFormPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<DecorationApplicationFormEntity> decorationApplicationFormSuperWrapper = new QueryWrapper<>();
decorationApplicationFormSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(decorationApplicationFormSuperWrapper, DecorationApplicationFormEntity.class, queryJson, "0"));
int decorationApplicationFormNum1 = decorationApplicationFormSuperWrapper.getExpression().getNormal().size();
if (decorationApplicationFormNum1 > 0) {
List<String> decorationApplicationFormList = this.list(decorationApplicationFormSuperWrapper).stream().map(DecorationApplicationFormEntity::getId).collect(Collectors.toList());
allSuperList.addAll(decorationApplicationFormList);
intersectionSuperList.add(decorationApplicationFormList);
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<DecorationApplicationFormEntity> decorationApplicationFormSuperWrapper = new QueryWrapper<>();
decorationApplicationFormSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(decorationApplicationFormSuperWrapper, DecorationApplicationFormEntity.class, ruleJson, "0"));
int decorationApplicationFormNum1 = decorationApplicationFormSuperWrapper.getExpression().getNormal().size();
if (decorationApplicationFormNum1 > 0) {
List<String> decorationApplicationFormList = this.list(decorationApplicationFormSuperWrapper).stream().map(DecorationApplicationFormEntity::getId).collect(Collectors.toList());
allRuleList.addAll(decorationApplicationFormList);
intersectionRuleList.add(decorationApplicationFormList);
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 decorationApplicationFormObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(decorationApplicationFormQueryWrapper, DecorationApplicationFormEntity.class, decorationApplicationFormPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(decorationApplicationFormObj)) {
return new ArrayList<>();
} else {
decorationApplicationFormQueryWrapper = (QueryWrapper<DecorationApplicationFormEntity>) decorationApplicationFormObj;
if (decorationApplicationFormQueryWrapper.getExpression().getNormal().size() > 0) {
decorationApplicationFormNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object decorationApplicationFormObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(decorationApplicationFormQueryWrapper, DecorationApplicationFormEntity.class, decorationApplicationFormPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(decorationApplicationFormObj)) {
return new ArrayList<>();
} else {
decorationApplicationFormQueryWrapper = (QueryWrapper<DecorationApplicationFormEntity>) decorationApplicationFormObj;
if (decorationApplicationFormQueryWrapper.getExpression().getNormal().size() > 0) {
decorationApplicationFormNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getCreationTime())) {
decorationApplicationFormNum++;
List CreationTimeList = JsonUtil.getJsonToList(decorationApplicationFormPagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
decorationApplicationFormQueryWrapper.lambda().ge(DecorationApplicationFormEntity::getCreationTime, new Date(fir))
.le(DecorationApplicationFormEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getMerchantName())) {
decorationApplicationFormNum++;
String value = decorationApplicationFormPagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(decorationApplicationFormPagination.getMerchantName()) :
String.valueOf(decorationApplicationFormPagination.getMerchantName());
decorationApplicationFormQueryWrapper.lambda().like(DecorationApplicationFormEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getSpaceName())) {
decorationApplicationFormNum++;
String value = decorationApplicationFormPagination.getSpaceName() instanceof List ?
JsonUtil.getObjectToString(decorationApplicationFormPagination.getSpaceName()) :
String.valueOf(decorationApplicationFormPagination.getSpaceName());
decorationApplicationFormQueryWrapper.lambda().like(DecorationApplicationFormEntity::getSpaceName, value);
}
if (ObjectUtil.isNotEmpty(decorationApplicationFormPagination.getDecorationProgress())) {
decorationApplicationFormNum++;
List<String> idList = new ArrayList<>();
try {
String[][] decorationProgress = JsonUtil.getJsonToBean(decorationApplicationFormPagination.getDecorationProgress(), String[][].class);
for (int i = 0; i < decorationProgress.length; i++) {
if (decorationProgress[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(decorationProgress[i])));
}
}
} catch (Exception e1) {
try {
List<String> decorationProgress = JsonUtil.getJsonToList(decorationApplicationFormPagination.getDecorationProgress(), String.class);
if (decorationProgress.size() > 0) {
idList.addAll(decorationProgress);
}
} catch (Exception e2) {
idList.add(String.valueOf(decorationApplicationFormPagination.getDecorationProgress()));
}
}
decorationApplicationFormQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(DecorationApplicationFormEntity::getDecorationProgress, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
decorationApplicationFormQueryWrapper.lambda().in(DecorationApplicationFormEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
decorationApplicationFormQueryWrapper.lambda().and(t -> t.in(DecorationApplicationFormEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
decorationApplicationFormQueryWrapper.lambda().and(t -> t.in(DecorationApplicationFormEntity::getId, finalAllRuleIDlist));
}
//假删除标志
decorationApplicationFormQueryWrapper.lambda().isNull(DecorationApplicationFormEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(decorationApplicationFormPagination.getSidx())) {
decorationApplicationFormQueryWrapper.lambda().orderByDesc(DecorationApplicationFormEntity::getId);
} else {
try {
String sidx = decorationApplicationFormPagination.getSidx();
String[] strs = sidx.split("_name");
DecorationApplicationFormEntity decorationApplicationFormEntity = new DecorationApplicationFormEntity();
Field declaredField = decorationApplicationFormEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
decorationApplicationFormQueryWrapper = "asc".equals(decorationApplicationFormPagination.getSort().toLowerCase()) ? decorationApplicationFormQueryWrapper.orderByAsc(value) : decorationApplicationFormQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<DecorationApplicationFormEntity> page = new Page<>(decorationApplicationFormPagination.getCurrentPage(), decorationApplicationFormPagination.getPageSize());
IPage<DecorationApplicationFormEntity> userIPage = this.page(page, decorationApplicationFormQueryWrapper);
return decorationApplicationFormPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<DecorationApplicationFormEntity> list = new ArrayList();
return decorationApplicationFormPagination.setData(list, list.size());
}
} else {
return this.list(decorationApplicationFormQueryWrapper);
}
}
@Override
public DecorationApplicationFormEntity getInfo(String id) {
QueryWrapper<DecorationApplicationFormEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(DecorationApplicationFormEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(DecorationApplicationFormEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, DecorationApplicationFormEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(DecorationApplicationFormEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* i-0-1
*/
@Override
public String checkForm(DecorationApplicationFormForm 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.getContacts())) {
return "联系人不能为空";
}
if (StringUtil.isEmpty(form.getContactsPhone())) {
return "联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
if (StringUtil.isEmpty(form.getDepositAmount())) {
return "押金金额不能为空";
}
if (StringUtil.isNotEmpty(form.getDepositAmount())) {
if (!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getDepositAmount())).matches()) {
return "请输入正确的金额";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param decorationApplicationFormForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(DecorationApplicationFormForm decorationApplicationFormForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
decorationApplicationFormForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(DecorationApplicationFormConstant.getFormData(), decorationApplicationFormForm), DecorationApplicationFormForm.class);
DecorationApplicationFormEntity entity = JsonUtil.getJsonToBean(decorationApplicationFormForm, DecorationApplicationFormEntity.class);
//todo 需要更新空间信息
if (isSave) {
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String mainId = RandomUtil.uuId();
entity.setCreateBy(userProvider.get().getUserId());
entity.setCreationTime(DateUtil.getNowDate());
entity.setApplicationNumber("ZX" + currentDate + RandomUtil.uuId().substring(0, 4));
entity.setId(mainId);
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,373 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.VenueReservationRecordMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.venuereservationrecord.*;
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.time.LocalDate;
import java.time.format.DateTimeFormatter;
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;
/**
* VenueReservationRecord
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-07-18
*/
@Service
public class VenueReservationRecordServiceImpl extends ServiceImpl<VenueReservationRecordMapper, VenueReservationRecordEntity> implements VenueReservationRecordService {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<VenueReservationRecordEntity> getList(VenueReservationRecordPagination venueReservationRecordPagination) {
return getTypeList(venueReservationRecordPagination, venueReservationRecordPagination.getDataType());
}
/**
*
*/
@Override
public List<VenueReservationRecordEntity> getTypeList(VenueReservationRecordPagination venueReservationRecordPagination, 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 ? VenueReservationRecordConstant.getAppColumnData() : VenueReservationRecordConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total = 0;
int venueReservationRecordNum = 0;
QueryWrapper<VenueReservationRecordEntity> venueReservationRecordQueryWrapper = new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp = "";
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getSuperQueryJson())) {
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = venueReservationRecordPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<VenueReservationRecordEntity> venueReservationRecordSuperWrapper = new QueryWrapper<>();
venueReservationRecordSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(venueReservationRecordSuperWrapper, VenueReservationRecordEntity.class, queryJson, "0"));
int venueReservationRecordNum1 = venueReservationRecordSuperWrapper.getExpression().getNormal().size();
if (venueReservationRecordNum1 > 0) {
List<String> venueReservationRecordList = this.list(venueReservationRecordSuperWrapper).stream().map(VenueReservationRecordEntity::getId).collect(Collectors.toList());
allSuperList.addAll(venueReservationRecordList);
intersectionSuperList.add(venueReservationRecordList);
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<VenueReservationRecordEntity> venueReservationRecordSuperWrapper = new QueryWrapper<>();
venueReservationRecordSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(venueReservationRecordSuperWrapper, VenueReservationRecordEntity.class, ruleJson, "0"));
int venueReservationRecordNum1 = venueReservationRecordSuperWrapper.getExpression().getNormal().size();
if (venueReservationRecordNum1 > 0) {
List<String> venueReservationRecordList = this.list(venueReservationRecordSuperWrapper).stream().map(VenueReservationRecordEntity::getId).collect(Collectors.toList());
allRuleList.addAll(venueReservationRecordList);
intersectionRuleList.add(venueReservationRecordList);
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 venueReservationRecordObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(venueReservationRecordQueryWrapper, VenueReservationRecordEntity.class, venueReservationRecordPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(venueReservationRecordObj)) {
return new ArrayList<>();
} else {
venueReservationRecordQueryWrapper = (QueryWrapper<VenueReservationRecordEntity>) venueReservationRecordObj;
if (venueReservationRecordQueryWrapper.getExpression().getNormal().size() > 0) {
venueReservationRecordNum++;
}
}
}
}
if (!isPc && appPermission) {
if (!userProvider.get().getIsAdministrator()) {
Object venueReservationRecordObj = generaterSwapUtil.getAuthorizeCondition(new QueryModel(venueReservationRecordQueryWrapper, VenueReservationRecordEntity.class, venueReservationRecordPagination.getMenuId(), "0"));
if (ObjectUtil.isEmpty(venueReservationRecordObj)) {
return new ArrayList<>();
} else {
venueReservationRecordQueryWrapper = (QueryWrapper<VenueReservationRecordEntity>) venueReservationRecordObj;
if (venueReservationRecordQueryWrapper.getExpression().getNormal().size() > 0) {
venueReservationRecordNum++;
}
}
}
}
if (isPc) {
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getCreationTime())) {
venueReservationRecordNum++;
List CreationTimeList = JsonUtil.getJsonToList(venueReservationRecordPagination.getCreationTime(), String.class);
Long fir = Long.valueOf(String.valueOf(CreationTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreationTimeList.get(1)));
venueReservationRecordQueryWrapper.lambda().ge(VenueReservationRecordEntity::getCreationTime, new Date(fir))
.le(VenueReservationRecordEntity::getCreationTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getMerchantName())) {
venueReservationRecordNum++;
String value = venueReservationRecordPagination.getMerchantName() instanceof List ?
JsonUtil.getObjectToString(venueReservationRecordPagination.getMerchantName()) :
String.valueOf(venueReservationRecordPagination.getMerchantName());
venueReservationRecordQueryWrapper.lambda().like(VenueReservationRecordEntity::getMerchantName, value);
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getSpaceName())) {
venueReservationRecordNum++;
String value = venueReservationRecordPagination.getSpaceName() instanceof List ?
JsonUtil.getObjectToString(venueReservationRecordPagination.getSpaceName()) :
String.valueOf(venueReservationRecordPagination.getSpaceName());
venueReservationRecordQueryWrapper.lambda().like(VenueReservationRecordEntity::getSpaceName, value);
}
if (ObjectUtil.isNotEmpty(venueReservationRecordPagination.getUsageProgress())) {
venueReservationRecordNum++;
List<String> idList = new ArrayList<>();
try {
String[][] usageProgress = JsonUtil.getJsonToBean(venueReservationRecordPagination.getUsageProgress(), String[][].class);
for (int i = 0; i < usageProgress.length; i++) {
if (usageProgress[i].length > 0) {
idList.add(JsonUtil.getObjectToString(Arrays.asList(usageProgress[i])));
}
}
} catch (Exception e1) {
try {
List<String> usageProgress = JsonUtil.getJsonToList(venueReservationRecordPagination.getUsageProgress(), String.class);
if (usageProgress.size() > 0) {
idList.addAll(usageProgress);
}
} catch (Exception e2) {
idList.add(String.valueOf(venueReservationRecordPagination.getUsageProgress()));
}
}
venueReservationRecordQueryWrapper.lambda().and(t -> {
idList.forEach(tt -> {
t.like(VenueReservationRecordEntity::getUsageProgress, tt).or();
});
});
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total > 0) {
if (intersection.size() == 0) {
intersection.add("jnpfNullList");
}
venueReservationRecordQueryWrapper.lambda().in(VenueReservationRecordEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)) {
if (allSuperIDlist.size() == 0) {
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
venueReservationRecordQueryWrapper.lambda().and(t -> t.in(VenueReservationRecordEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)) {
if (allRuleIDlist.size() == 0) {
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
venueReservationRecordQueryWrapper.lambda().and(t -> t.in(VenueReservationRecordEntity::getId, finalAllRuleIDlist));
}
//假删除标志
venueReservationRecordQueryWrapper.lambda().isNull(VenueReservationRecordEntity::getDeleteMark);
//排序
if (StringUtil.isEmpty(venueReservationRecordPagination.getSidx())) {
venueReservationRecordQueryWrapper.lambda().orderByDesc(VenueReservationRecordEntity::getId);
} else {
try {
String sidx = venueReservationRecordPagination.getSidx();
String[] strs = sidx.split("_name");
VenueReservationRecordEntity venueReservationRecordEntity = new VenueReservationRecordEntity();
Field declaredField = venueReservationRecordEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
venueReservationRecordQueryWrapper = "asc".equals(venueReservationRecordPagination.getSort().toLowerCase()) ? venueReservationRecordQueryWrapper.orderByAsc(value) : venueReservationRecordQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if ("0".equals(dataType)) {
if ((total > 0 && AllIdList.size() > 0) || total == 0) {
Page<VenueReservationRecordEntity> page = new Page<>(venueReservationRecordPagination.getCurrentPage(), venueReservationRecordPagination.getPageSize());
IPage<VenueReservationRecordEntity> userIPage = this.page(page, venueReservationRecordQueryWrapper);
return venueReservationRecordPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
List<VenueReservationRecordEntity> list = new ArrayList();
return venueReservationRecordPagination.setData(list, list.size());
}
} else {
return this.list(venueReservationRecordQueryWrapper);
}
}
@Override
public VenueReservationRecordEntity getInfo(String id) {
QueryWrapper<VenueReservationRecordEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(VenueReservationRecordEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(VenueReservationRecordEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, VenueReservationRecordEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(VenueReservationRecordEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
/**
* i-0-1
*/
@Override
public String checkForm(VenueReservationRecordForm 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.getContacts())) {
return "联系人不能为空";
}
if (StringUtil.isEmpty(form.getContactsPhone())) {
return "联系电话不能为空";
}
if (StringUtil.isNotEmpty(form.getContactsPhone())) {
if (!Pattern.compile("^1[3456789]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$").matcher(String.valueOf(form.getContactsPhone())).matches()) {
return "请输入正确的联系方式";
}
}
if (StringUtil.isEmpty(form.getReservationsNumber())) {
return "预约人数不能为空";
}
if (StringUtil.isNotEmpty(form.getReservationsNumber())) {
if (!Pattern.compile("^\\d+$").matcher(String.valueOf(form.getReservationsNumber())).matches()) {
return "请输入正确的数字";
}
}
return countRecover;
}
/**
* ()
*
* @param id
* @param venueReservationRecordForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(VenueReservationRecordForm venueReservationRecordForm, String id, boolean isSave) throws Exception {
UserInfo userInfo = userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
venueReservationRecordForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(VenueReservationRecordConstant.getFormData(), venueReservationRecordForm), VenueReservationRecordForm.class);
VenueReservationRecordEntity entity = JsonUtil.getJsonToBean(venueReservationRecordForm, VenueReservationRecordEntity.class);
//todo 更新空间表
if (isSave) {
//获取当前年月日
String currentDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
String mainId = RandomUtil.uuId();
entity.setCreateBy(userProvider.get().getUserId());
entity.setCreationTime(DateUtil.getNowDate());
entity.setApplicationNumber("YY" + currentDate + RandomUtil.uuId().substring(0, 4));
entity.setId(mainId);
entity.setVersion(0);
} else {
entity.setCreationTime(DateUtil.getNowDate());
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,364 @@
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.decorationapplicationform.*;
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;
/**
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Slf4j
@RestController
@Tag(name = "DecorationApplicationForm" , description = "example")
@RequestMapping("/api/example/DecorationApplicationForm")
public class DecorationApplicationFormController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private DecorationApplicationFormService decorationApplicationFormService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param decorationApplicationFormPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody DecorationApplicationFormPagination decorationApplicationFormPagination)throws IOException{
List<DecorationApplicationFormEntity> list= decorationApplicationFormService.getList(decorationApplicationFormPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (DecorationApplicationFormEntity entity : list) {
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
realList.add(decorationApplicationFormMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, DecorationApplicationFormConstant.getFormData(), DecorationApplicationFormConstant.getColumnData(), decorationApplicationFormPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(decorationApplicationFormPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param decorationApplicationFormForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid DecorationApplicationFormForm decorationApplicationFormForm) {
String b = decorationApplicationFormService.checkForm(decorationApplicationFormForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
decorationApplicationFormService.saveOrUpdate(decorationApplicationFormForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody DecorationApplicationFormPagination decorationApplicationFormPagination) throws IOException {
if (StringUtil.isEmpty(decorationApplicationFormPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<DecorationApplicationFormEntity> list= decorationApplicationFormService.getList(decorationApplicationFormPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (DecorationApplicationFormEntity entity : list) {
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
realList.add(decorationApplicationFormMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, DecorationApplicationFormConstant.getFormData(), DecorationApplicationFormConstant.getColumnData(), decorationApplicationFormPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(decorationApplicationFormPagination.getSelectKey())?decorationApplicationFormPagination.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 "applicationNumber" :
entitys.add(new ExcelExportEntity("申请单号" ,"applicationNumber"));
break;
case "merchantId" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantId"));
break;
case "contractId" :
entitys.add(new ExcelExportEntity("合同名称" ,"contractId"));
break;
case "spaceId" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceId"));
break;
case "expectedStartTime" :
entitys.add(new ExcelExportEntity("预计开始时间" ,"expectedStartTime"));
break;
case "expectedEndTime" :
entitys.add(new ExcelExportEntity("预计结束时间" ,"expectedEndTime"));
break;
case "contacts" :
entitys.add(new ExcelExportEntity("联系人" ,"contacts"));
break;
case "contactsPhone" :
entitys.add(new ExcelExportEntity("联系电话" ,"contactsPhone"));
break;
case "depositAmount" :
entitys.add(new ExcelExportEntity("押金金额" ,"depositAmount"));
break;
case "isTheDepositRefunded" :
entitys.add(new ExcelExportEntity("押金是否退回" ,"isTheDepositRefunded"));
break;
case "depositRefundDate" :
entitys.add(new ExcelExportEntity("押金退回日期" ,"depositRefundDate"));
break;
case "decorationProgress" :
entitys.add(new ExcelExportEntity("装修进度" ,"decorationProgress"));
break;
case "fieldPhoto" :
entitys.add(new ExcelExportEntity("实地照片" ,"fieldPhoto"));
break;
case "creationTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creationTime"));
break;
case "merchantName" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantName"));
break;
case "spaceName" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceName"));
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(DecorationApplicationFormConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param id
* @param decorationApplicationFormForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid DecorationApplicationFormForm decorationApplicationFormForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
decorationApplicationFormForm.setId(id);
if (!isImport) {
String b = decorationApplicationFormService.checkForm(decorationApplicationFormForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity!=null){
try{
decorationApplicationFormService.saveOrUpdate(decorationApplicationFormForm,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){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
decorationApplicationFormService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
decorationApplicationFormMap = generaterSwapUtil.swapDataDetail(decorationApplicationFormMap,DecorationApplicationFormConstant.getFormData(),"583556228408410885",false);
return ActionResult.success(decorationApplicationFormMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
DecorationApplicationFormEntity entity= decorationApplicationFormService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> decorationApplicationFormMap=JsonUtil.entityToMap(entity);
decorationApplicationFormMap.put("id", decorationApplicationFormMap.get("id"));
//副表数据
//子表数据
decorationApplicationFormMap = generaterSwapUtil.swapDataForm(decorationApplicationFormMap,DecorationApplicationFormConstant.getFormData(),DecorationApplicationFormConstant.TABLEFIELDKEY,DecorationApplicationFormConstant.TABLERENAMES);
return ActionResult.success(decorationApplicationFormMap);
}
}

@ -0,0 +1,355 @@
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.venuereservationrecord.*;
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;
/**
* VenueReservationRecord
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Slf4j
@RestController
@Tag(name = "VenueReservationRecord" , description = "example")
@RequestMapping("/api/example/VenueReservationRecord")
public class VenueReservationRecordController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private VenueReservationRecordService venueReservationRecordService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param venueReservationRecordPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody VenueReservationRecordPagination venueReservationRecordPagination)throws IOException{
List<VenueReservationRecordEntity> list= venueReservationRecordService.getList(venueReservationRecordPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (VenueReservationRecordEntity entity : list) {
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
realList.add(venueReservationRecordMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, VenueReservationRecordConstant.getFormData(), VenueReservationRecordConstant.getColumnData(), venueReservationRecordPagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(venueReservationRecordPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param venueReservationRecordForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid VenueReservationRecordForm venueReservationRecordForm) {
String b = venueReservationRecordService.checkForm(venueReservationRecordForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
venueReservationRecordService.saveOrUpdate(venueReservationRecordForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody VenueReservationRecordPagination venueReservationRecordPagination) throws IOException {
if (StringUtil.isEmpty(venueReservationRecordPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<VenueReservationRecordEntity> list= venueReservationRecordService.getList(venueReservationRecordPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (VenueReservationRecordEntity entity : list) {
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
realList.add(venueReservationRecordMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, VenueReservationRecordConstant.getFormData(), VenueReservationRecordConstant.getColumnData(), venueReservationRecordPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(venueReservationRecordPagination.getSelectKey())?venueReservationRecordPagination.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 "applicationNumber" :
entitys.add(new ExcelExportEntity("申请单号" ,"applicationNumber"));
break;
case "merchantId" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantId"));
break;
case "spaceId" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceId"));
break;
case "startTime" :
entitys.add(new ExcelExportEntity("开始时间" ,"startTime"));
break;
case "endTime" :
entitys.add(new ExcelExportEntity("结束时间" ,"endTime"));
break;
case "contacts" :
entitys.add(new ExcelExportEntity("联系人" ,"contacts"));
break;
case "contactsPhone" :
entitys.add(new ExcelExportEntity("联系电话" ,"contactsPhone"));
break;
case "reservationsNumber" :
entitys.add(new ExcelExportEntity("预约人数" ,"reservationsNumber"));
break;
case "reservationsThing" :
entitys.add(new ExcelExportEntity("预约事由" ,"reservationsThing"));
break;
case "usageProgress" :
entitys.add(new ExcelExportEntity("预约进度" ,"usageProgress"));
break;
case "creationTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creationTime"));
break;
case "spaceName" :
entitys.add(new ExcelExportEntity("空间名称" ,"spaceName"));
break;
case "merchantName" :
entitys.add(new ExcelExportEntity("商户名称" ,"merchantName"));
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(VenueReservationRecordConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param id
* @param venueReservationRecordForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid VenueReservationRecordForm venueReservationRecordForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
venueReservationRecordForm.setId(id);
if (!isImport) {
String b = venueReservationRecordService.checkForm(venueReservationRecordForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity!=null){
try{
venueReservationRecordService.saveOrUpdate(venueReservationRecordForm,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){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
venueReservationRecordService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
venueReservationRecordMap = generaterSwapUtil.swapDataDetail(venueReservationRecordMap,VenueReservationRecordConstant.getFormData(),"583566974336893829",false);
return ActionResult.success(venueReservationRecordMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
VenueReservationRecordEntity entity= venueReservationRecordService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> venueReservationRecordMap=JsonUtil.entityToMap(entity);
venueReservationRecordMap.put("id", venueReservationRecordMap.get("id"));
//副表数据
//子表数据
venueReservationRecordMap = generaterSwapUtil.swapDataForm(venueReservationRecordMap,VenueReservationRecordConstant.getFormData(),VenueReservationRecordConstant.TABLEFIELDKEY,VenueReservationRecordConstant.TABLERENAMES);
return ActionResult.success(venueReservationRecordMap);
}
}

@ -0,0 +1,84 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.math.BigDecimal;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
@TableName("yq_decoration_application_form")
public class DecorationApplicationFormEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "APPLICATION_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String applicationNumber;
@TableField("CONTRACT_NAME")
private String contractName;
@TableField(value = "CONTRACT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String contractId;
@TableField("DECORATION_INSTRUCTIONS")
private String decorationInstructions;
@TableField(value = "EXPECTED_START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date expectedStartTime;
@TableField(value = "EXPECTED_END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date expectedEndTime;
@TableField(value = "DEPOSIT_AMOUNT" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal depositAmount;
@TableField(value = "IS_THE_DEPOSIT_REFUNDED" , updateStrategy = FieldStrategy.IGNORED)
private String isTheDepositRefunded;
@TableField(value = "DEPOSIT_REFUND_DATE" , updateStrategy = FieldStrategy.IGNORED)
private Date depositRefundDate;
@TableField(value = "CONTACTS" , updateStrategy = FieldStrategy.IGNORED)
private String contacts;
@TableField(value = "DECORATION_PROGRESS" , updateStrategy = FieldStrategy.IGNORED)
private String decorationProgress;
@TableField(value = "FIELD_PHOTO" , updateStrategy = FieldStrategy.IGNORED)
private String fieldPhoto;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String contactsPhone;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_DATE")
private Date submissionDate;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("COMPANY")
private String company;
@TableField("DEPARTMENT")
private String department;
@TableField("ORGANIZATION")
private String organization;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,73 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
@TableName("yq_venue_reservation_record")
public class VenueReservationRecordEntity {
@TableId(value ="ID" )
private String id;
@TableField("CREATE_BY")
private String createBy;
@TableField("CREATION_TIME")
private Date creationTime;
@TableField("UPDATE_BY")
private String updateBy;
@TableField("UPDATE_TIME")
private Date updateTime;
@TableField(value = "MERCHANT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String merchantId;
@TableField(value = "MERCHANT_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String merchantName;
@TableField(value = "APPLICATION_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String applicationNumber;
@TableField(value = "RESERVATIONS_THING" , updateStrategy = FieldStrategy.IGNORED)
private String reservationsThing;
@TableField(value = "RESERVATIONS_NUMBER" , updateStrategy = FieldStrategy.IGNORED)
private String reservationsNumber;
@TableField(value = "USAGE_PROGRESS" , updateStrategy = FieldStrategy.IGNORED)
private String usageProgress;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField("SUBMITTER")
private String submitter;
@TableField("SUBMISSION_TIME")
private Date submissionTime;
@TableField(value = "CONTACTS" , updateStrategy = FieldStrategy.IGNORED)
private String contacts;
@TableField(value = "CONTACTS_PHONE" , updateStrategy = FieldStrategy.IGNORED)
private String contactsPhone;
@TableField(value = "SPACE_ID" , updateStrategy = FieldStrategy.IGNORED)
private String spaceId;
@TableField(value = "SPACE_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String spaceName;
@TableField("REMARKS")
private String remarks;
@TableField("OPTIMISTIC_LOCK")
private Integer optimisticLock;
@TableField("CELETE_TAGS")
private Integer celeteTags;
@TableField("COMPANY")
private String company;
@TableField("DEPARTMENT")
private String department;
@TableField("ORGANIZATION")
private String organization;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,71 @@
package jnpf.model.decorationapplicationform;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class DecorationApplicationFormForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 申请单号 **/
@JsonProperty("applicationNumber")
private String applicationNumber;
/** 商户名称 **/
@JsonProperty("merchantId")
private String merchantId;
/** 合同名称 **/
@JsonProperty("contractId")
private String contractId;
/** 空间名称 **/
@JsonProperty("spaceId")
private String spaceId;
/** 预计开始时间 **/
@JsonProperty("expectedStartTime")
private String expectedStartTime;
/** 预计结束时间 **/
@JsonProperty("expectedEndTime")
private String expectedEndTime;
/** 联系人 **/
@JsonProperty("contacts")
private String contacts;
/** 联系电话 **/
@JsonProperty("contactsPhone")
private String contactsPhone;
/** 押金金额 **/
@JsonProperty("depositAmount")
private String depositAmount;
/** 押金是否退回 **/
@JsonProperty("isTheDepositRefunded")
private Object isTheDepositRefunded;
/** 押金退回日期 **/
@JsonProperty("depositRefundDate")
private String depositRefundDate;
/** 装修进度 **/
@JsonProperty("decorationProgress")
private Object decorationProgress;
/** 实地照片 **/
@JsonProperty("fieldPhoto")
private Object fieldPhoto;
/** 创建时间 **/
@JsonProperty("creationTime")
private String creationTime;
/** 商户名称 **/
@JsonProperty("merchantName")
private String merchantName;
/** 空间名称 **/
@JsonProperty("spaceName")
private String spaceName;
}

@ -0,0 +1,42 @@
package jnpf.model.decorationapplicationform;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* DecorationApplicationForm
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class DecorationApplicationFormPagination 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("creationTime")
private Object creationTime;
/** 商户名称 */
@JsonProperty("merchantName")
private Object merchantName;
/** 空间名称 */
@JsonProperty("spaceName")
private Object spaceName;
/** 装修进度 */
@JsonProperty("decorationProgress")
private Object decorationProgress;
}

@ -0,0 +1,62 @@
package jnpf.model.venuereservationrecord;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* VenueReservationRecord
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class VenueReservationRecordForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 申请单号 **/
@JsonProperty("applicationNumber")
private String applicationNumber;
/** 商户名称 **/
@JsonProperty("merchantId")
private String merchantId;
/** 空间名称 **/
@JsonProperty("spaceId")
private String spaceId;
/** 开始时间 **/
@JsonProperty("startTime")
private String startTime;
/** 结束时间 **/
@JsonProperty("endTime")
private String endTime;
/** 联系人 **/
@JsonProperty("contacts")
private String contacts;
/** 联系电话 **/
@JsonProperty("contactsPhone")
private String contactsPhone;
/** 预约人数 **/
@JsonProperty("reservationsNumber")
private String reservationsNumber;
/** 预约事由 **/
@JsonProperty("reservationsThing")
private String reservationsThing;
/** 预约进度 **/
@JsonProperty("usageProgress")
private Object usageProgress;
/** 创建时间 **/
@JsonProperty("creationTime")
private String creationTime;
/** 空间名称 **/
@JsonProperty("spaceName")
private String spaceName;
/** 商户名称 **/
@JsonProperty("merchantName")
private String merchantName;
}

@ -0,0 +1,42 @@
package jnpf.model.venuereservationrecord;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* VenueReservationRecord
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-07-18
*/
@Data
public class VenueReservationRecordPagination 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("creationTime")
private Object creationTime;
/** 商户名称 */
@JsonProperty("merchantName")
private Object merchantName;
/** 空间名称 */
@JsonProperty("spaceName")
private Object spaceName;
/** 预约进度 */
@JsonProperty("usageProgress")
private Object usageProgress;
}

@ -0,0 +1,169 @@
<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="8">
<jnpf-form-tip-item label="申请单号" prop="applicationNumber">
<p>{{ dataForm.applicationNumber }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="商户名称" prop="merchantId">
<p>{{ dataForm.merchantId }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="合同名称" prop="contractId">
<p>{{ dataForm.contractId }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="空间名称" prop="spaceId">
<p>{{ dataForm.spaceId }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预计开始时间" prop="expectedStartTime">
<p>{{ dataForm.expectedStartTime }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预计结束时间" prop="expectedEndTime">
<p>{{ dataForm.expectedEndTime }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系人" prop="contacts">
<p>{{ dataForm.contacts }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系电话" prop="contactsPhone">
<p>{{ dataForm.contactsPhone }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金金额" prop="depositAmount">
<p>{{ dataForm.depositAmount }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金是否退回" prop="isTheDepositRefunded">
<p>{{ dataForm.isTheDepositRefunded }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金退回日期" prop="depositRefundDate">
<p>{{ dataForm.depositRefundDate }}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="装修进度" prop="decorationProgress">
<p>{{ dataForm.decorationProgress }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="实地照片" prop="fieldPhoto">
<JnpfUploadImg v-model="dataForm.fieldPhoto" disabled detailed :fileSize="10" sizeUnit="MB"
:limit="9" pathType="defaultPath" :isAccount="0">
</JnpfUploadImg>
</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: '',
applicationNumber: '',
merchantId: "",
contractId: "",
spaceId: "3",
expectedStartTime: '',
expectedEndTime: '',
contacts: '',
contactsPhone: '',
depositAmount: '',
isTheDepositRefunded: "2",
depositRefundDate: '',
decorationProgress: "1",
fieldPhoto: [],
creationTime: "",
merchantName: '',
spaceName: '',
},
isTheDepositRefundedOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "2" }],
isTheDepositRefundedProps: { "label": "fullName", "value": "id" },
decorationProgressOptions: [{ "fullName": "待装修", "id": "1" }, { "fullName": "装修中", "id": "2" }, { "fullName": "已装修", "id": "3" }],
decorationProgressProps: { "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/DecorationApplicationForm/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,611 @@
<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="1000px">
<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="8">
<jnpf-form-tip-item label="申请单号" prop="applicationNumber">
<JnpfInput v-model="dataForm.applicationNumber" @change="changeData('applicationNumber', -1)"
placeholder="自动生成" disabled clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="商户名称" prop="merchantId">
<JnpfPopupSelect v-model="dataForm.merchantId" @change="changeData('merchantId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.merchantId"
placeholder="请选择商户" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='cmp_nm' field='merchantId'
interfaceId="583216109528809989" :pageSize="20" :columnOptions="merchantIdcolumnOptions"
clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="合同名称" prop="contractId">
<JnpfPopupSelect v-model="dataForm.contractId" @change="changeData('contractId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.contractId"
placeholder="请选择合同" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='contract_name' field='contractId'
interfaceId="583555851390812933" :pageSize="20" :columnOptions="contractIdcolumnOptions"
clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="空间名称" prop="spaceId">
<JnpfPopupSelect v-model="dataForm.spaceId" @change="changeData('spaceId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.spaceId"
placeholder="请选择空间" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' field='spaceId' interfaceId="582825768971670725"
:pageSize="20" :columnOptions="spaceIdcolumnOptions" clearable
:style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预计开始时间" prop="expectedStartTime">
<JnpfDatePicker v-model="dataForm.expectedStartTime"
@change="changeData('expectedStartTime', -1)" :startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择预计开始时间" clearable
:style='{ "width": "100%" }' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预计结束时间" prop="expectedEndTime">
<JnpfDatePicker v-model="dataForm.expectedEndTime"
@change="changeData('expectedEndTime', -1)" :startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择预计结束时间" clearable
:style='{ "width": "100%" }' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系人" prop="contacts">
<JnpfInput v-model="dataForm.contacts" @change="changeData('contacts', -1)"
placeholder="请输入联系人" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系电话" prop="contactsPhone">
<JnpfInput v-model="dataForm.contactsPhone" @change="changeData('contactsPhone', -1)"
placeholder="请输入联系电话" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金金额" prop="depositAmount">
<JnpfInput v-model="dataForm.depositAmount" @change="changeData('depositAmount', -1)"
placeholder="请输入" addonAfter="元" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金是否退回" prop="isTheDepositRefunded">
<JnpfSelect v-model="dataForm.isTheDepositRefunded"
@change="changeData('isTheDepositRefunded', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' :options="isTheDepositRefundedOptions"
:props="isTheDepositRefundedProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="押金退回日期" prop="depositRefundDate">
<JnpfDatePicker v-model="dataForm.depositRefundDate"
@change="changeData('depositRefundDate', -1)" :startTime="dateTime(false, 1, 1, '', '')"
:endTime="dateTime(false, 1, 1, '', '')" placeholder="请选择" clearable
:style='{ "width": "100%" }' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="装修进度" prop="decorationProgress">
<JnpfSelect v-model="dataForm.decorationProgress"
@change="changeData('decorationProgress', -1)" placeholder="请选择" clearable
:style='{ "width": "100%" }' :options="decorationProgressOptions"
:props="decorationProgressProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="实地照片" prop="fieldPhoto">
<JnpfUploadImg v-model="dataForm.fieldPhoto" @change="changeData('fieldPhoto', -1)"
:fileSize="10" sizeUnit="MB" :limit="9" pathType="defaultPath" :isAccount="0">
</JnpfUploadImg>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{ '下一条' }}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: {},
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting: {},
eventType: '',
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
},
//
ableAll: {
},
tableRows: {
},
Vmodel: "",
currVmodel: "",
dataForm: {
applicationNumber: undefined,
merchantId: undefined,
contractId: undefined,
spaceId: undefined,
expectedStartTime: undefined,
expectedEndTime: undefined,
contacts: undefined,
contactsPhone: undefined,
depositAmount: undefined,
isTheDepositRefunded: "2",
depositRefundDate: undefined,
decorationProgress: "1",
fieldPhoto: [],
creationTime: undefined,
merchantName: undefined,
spaceName: undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
merchantId: [
{
required: true,
message: '请选择商户',
trigger: 'change'
},
],
contractId: [
{
required: true,
message: '请选择合同',
trigger: 'change'
},
],
spaceId: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
expectedStartTime: [
{
required: true,
message: '请选择预计开始时间',
trigger: 'change'
},
],
expectedEndTime: [
{
required: true,
message: '请选择预计结束时间',
trigger: 'change'
},
],
contacts: [
{
required: true,
message: '请输入联系人',
trigger: 'blur'
},
],
contactsPhone: [
{
required: true,
message: '请输入联系电话',
trigger: 'blur'
},
{
pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/,
message: '请输入正确的联系方式',
trigger: 'blur'
},
],
depositAmount: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^([1-9][\d]*|0)(\.[\d]+)?$/,
message: '请输入正确的金额',
trigger: 'blur'
},
],
decorationProgress: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
fieldPhoto: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
merchantIdcolumnOptions: [{ "label": "公司编码", "value": "cmp_no" }, { "label": "公司名称", "value": "cmp_nm" }, { "label": "入驻状态", "value": "entry_status" }, { "label": "园区名称", "value": "park_name" },],
contractIdcolumnOptions: [{ "label": "合同编码", "value": "contract_number" }, { "label": "合同名称", "value": "contract_name" }, { "label": "合同状态", "value": "contract_status" }, { "label": "商户名称", "value": "merchant_id" }, { "label": "园区名称", "value": "park_name" },],
spaceIdcolumnOptions: [{ "label": "空间编码", "value": "code" }, { "label": "空间名称", "value": "name" }, { "label": "空间面积", "value": "space_area" }, { "label": "空间状态", "value": "state" },],
isTheDepositRefundedOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "2" }],
isTheDepositRefundedProps: { "label": "fullName", "value": "id" },
decorationProgressOptions: [{ "fullName": "待装修", "id": "1" }, { "fullName": "装修中", "id": "2" }, { "fullName": "已装修", "id": "3" }],
decorationProgressProps: { "label": "fullName", "value": "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
applicationNumber: [],
merchantId: [],
contractId: [],
spaceId: [],
expectedStartTime: [],
expectedEndTime: [],
contacts: [],
contactsPhone: [],
depositAmount: [],
isTheDepositRefunded: [],
depositRefundDate: [],
decorationProgress: [],
fieldPhoto: [],
creationTime: [],
merchantName: [],
spaceName: [],
},
}
},
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/DecorationApplicationForm/' + id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/example/DecorationApplicationForm/' + 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/DecorationApplicationForm',
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/DecorationApplicationForm/' + 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,491 @@
<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="提交日期">
<JnpfDateRangePicker v-model="query.creationTime" format="yyyy-MM-dd"
startPlaceholder="开始日期" endPlaceholder="结束日期" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商户名称">
<el-input v-model="query.merchantName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="空间名称">
<el-input v-model="query.spaceName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="装修进度">
<JnpfSelect v-model="query.decorationProgress" placeholder="请选择" clearable
:options="decorationProgressOptions" :props="decorationProgressProps" multiple>
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<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-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
收起
</el-button>
</el-form-item>
</el-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="success" icon="icon-ym icon-ym-btn-download" @click="exportData()">
</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'
:span-method="arraySpanMethod">
<el-table-column prop="applicationNumber" label="申请单号" align="left">
</el-table-column>
<el-table-column prop="merchantId" label="商户名称" align="left">
</el-table-column>
<el-table-column prop="contractId" label="合同名称" align="left">
</el-table-column>
<el-table-column prop="spaceId" label="空间名称" align="left">
</el-table-column>
<el-table-column prop="expectedStartTime" label="预计开始时间" align="left">
</el-table-column>
<el-table-column prop="expectedEndTime" label="预计结束时间" align="left">
</el-table-column>
<el-table-column prop="depositAmount" label="押金金额" align="left">
</el-table-column>
<el-table-column label="押金是否退回" prop="isTheDepositRefunded" algin="left">
<template slot-scope="scope">
{{ scope.row.isTheDepositRefunded }}
</template>
</el-table-column>
<el-table-column prop="depositRefundDate" label="押金退回日期" align="left">
</el-table-column>
<el-table-column label="装修进度" prop="decorationProgress" algin="left">
<template slot-scope="scope">
{{ scope.row.decorationProgress }}
</template>
</el-table-column>
<el-table-column prop="contacts" label="联系人" align="left">
</el-table-column>
<el-table-column prop="contactsPhone" label="联系电话" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" v-show="scope.row.decorationProgress != '已装修'" @click="addOrUpdateHandle(scope.row)">
</el-button>
<el-button type="text" v-show="scope.row.decorationProgress != '已装修'" 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,
showAll: false,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
creationTime: undefined,
merchantName: undefined,
spaceName: undefined,
decorationProgress: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
isTheDepositRefundedOptions: [{ "fullName": "是", "id": "1" }, { "fullName": "否", "id": "2" }],
isTheDepositRefundedProps: { "label": "fullName", "value": "id" },
decorationProgressOptions: [{ "fullName": "待装修", "id": "1" }, { "fullName": "装修中", "id": "2" }, { "fullName": "已装修", "id": "3" }],
decorationProgressProps: { "label": "fullName", "value": "id" },
interfaceRes: {
merchantId: [],
contractId: [],
spaceId: [],
},
}
},
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: '583556228408410885',
type: 1,
};
request({
url: `/api/example/DecorationApplicationForm/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/DecorationApplicationForm/${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/DecorationApplicationForm")
})
},
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/DecorationApplicationForm/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,159 @@
<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="8" >
<jnpf-form-tip-item label="申请单号"
prop="applicationNumber" >
<p>{{dataForm.applicationNumber}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="商户名称"
prop="merchantId" >
<p>{{dataForm.merchantId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="空间名称"
prop="spaceId" >
<p>{{dataForm.spaceId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="开始时间"
prop="startTime" >
<p>{{dataForm.startTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="结束时间"
prop="endTime" >
<p>{{dataForm.endTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="联系人"
prop="contacts" >
<p>{{dataForm.contacts}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="联系电话"
prop="contactsPhone" >
<p>{{dataForm.contactsPhone}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="预约人数"
prop="reservationsNumber" >
<p>{{dataForm.reservationsNumber}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="预约事由"
prop="reservationsThing" >
<p>{{dataForm.reservationsThing}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="预约进度"
prop="usageProgress" >
<p>{{ dataForm.usageProgress }} </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 :'',
applicationNumber : '',
merchantId : "",
spaceId : "",
startTime : '',
endTime : '',
contacts : '',
contactsPhone : '',
reservationsNumber : '',
reservationsThing : '',
usageProgress : "1",
creationTime : "",
spaceName : '',
merchantName : '',
},
usageProgressOptions:[{"fullName":"预约中","id":"1"},{"fullName":"已结束","id":"2"}],
usageProgressProps:{"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/VenueReservationRecord/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,566 @@
<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="1000px">
<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="8">
<jnpf-form-tip-item label="申请单号" prop="applicationNumber">
<JnpfInput v-model="dataForm.applicationNumber" @change="changeData('applicationNumber', -1)"
placeholder="自动生成" disabled clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="商户名称" prop="merchantId">
<JnpfPopupSelect v-model="dataForm.merchantId" @change="changeData('merchantId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.merchantId"
placeholder="请选择商户" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='cmp_nm' field='merchantId'
interfaceId="583216109528809989" :pageSize="20" :columnOptions="merchantIdcolumnOptions"
clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="空间名称" prop="spaceId">
<JnpfPopupSelect v-model="dataForm.spaceId" @change="changeData('spaceId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.spaceId"
placeholder="请选择空间" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' field='spaceId' interfaceId="583567455855575941"
:pageSize="20" :columnOptions="spaceIdcolumnOptions" clearable
:style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="开始时间" prop="startTime">
<JnpfDatePicker v-model="dataForm.startTime" @change="changeData('startTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择开始时间" clearable :style='{ "width": "100%" }' type="date"
format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="结束时间" prop="endTime">
<JnpfDatePicker v-model="dataForm.endTime" @change="changeData('endTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择结束时间" clearable :style='{ "width": "100%" }' type="date"
format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系人" prop="contacts">
<JnpfInput v-model="dataForm.contacts" @change="changeData('contacts', -1)"
placeholder="请输入联系人" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="联系电话" prop="contactsPhone">
<JnpfInput v-model="dataForm.contactsPhone" @change="changeData('contactsPhone', -1)"
placeholder="请输入联系电话" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预约人数" prop="reservationsNumber">
<JnpfInput v-model="dataForm.reservationsNumber"
@change="changeData('reservationsNumber', -1)" placeholder="请输入" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预约事由" prop="reservationsThing">
<JnpfTextarea v-model="dataForm.reservationsThing"
@change="changeData('reservationsThing', -1)" placeholder="请输入预约事由"
:style='{ "width": "100%" }' true type="textarea" :autosize='{ "minRows": 4, "maxRows": 4 }'>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="预约进度" prop="usageProgress">
<JnpfSelect v-model="dataForm.usageProgress" @change="changeData('usageProgress', -1)"
placeholder="请选择预约进度" clearable :style='{ "width": "100%" }'
:options="usageProgressOptions" :props="usageProgressProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
<span slot="footer" class="dialog-footer">
<div class="upAndDown-button" v-if="dataForm.id">
<el-button @click="prev" :disabled='prevDis'>
{{ '上一条' }}
</el-button>
<el-button @click="next" :disabled='nextDis'>
{{ '下一条' }}
</el-button>
</div>
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-button>
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: {},
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting: {},
eventType: '',
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
},
//
ableAll: {
},
tableRows: {
},
Vmodel: "",
currVmodel: "",
dataForm: {
applicationNumber: undefined,
merchantId: undefined,
spaceId: undefined,
startTime: undefined,
endTime: undefined,
contacts: undefined,
contactsPhone: undefined,
reservationsNumber: undefined,
reservationsThing: undefined,
usageProgress: "1",
creationTime: undefined,
spaceName: undefined,
merchantName: undefined,
version: 0,
},
tableRequiredData: {},
dataRule:
{
merchantId: [
{
required: true,
message: '请选择商户',
trigger: 'change'
},
],
spaceId: [
{
required: true,
message: '请选择空间',
trigger: 'change'
},
],
startTime: [
{
required: true,
message: '请选择开始时间',
trigger: 'change'
},
],
endTime: [
{
required: true,
message: '请选择结束时间',
trigger: 'change'
},
],
contacts: [
{
required: true,
message: '请输入联系人',
trigger: 'blur'
},
],
contactsPhone: [
{
required: true,
message: '请输入联系电话',
trigger: 'blur'
},
{
pattern: /^1[3456789]\d{9}$|^0\d{2,3}-?\d{7,8}$/,
message: '请输入正确的联系方式',
trigger: 'blur'
},
],
reservationsNumber: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^\d+$/,
message: '请输入正确的数字',
trigger: 'blur'
},
],
reservationsThing: [
{
required: true,
message: '请输入预约事由',
trigger: 'blur'
},
],
usageProgress: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
merchantIdcolumnOptions: [{ "label": "公司编码", "value": "cmp_no" }, { "label": "公司名称", "value": "cmp_nm" }, { "label": "入住状态", "value": "entry_status" }, { "label": "园区名称", "value": "park_name" },],
spaceIdcolumnOptions: [{ "label": "空间编码", "value": "code" }, { "label": "空间名称", "value": "name" }, { "label": "空间面积", "value": "space_area" }, { "label": "空间状态", "value": "state" },],
usageProgressOptions: [{ "fullName": "预约中", "id": "1" }, { "fullName": "已结束", "id": "2" }],
usageProgressProps: { "label": "fullName", "value": "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
applicationNumber: [],
merchantId: [],
spaceId: [],
startTime: [],
endTime: [],
contacts: [],
contactsPhone: [],
reservationsNumber: [],
reservationsThing: [],
usageProgress: [],
creationTime: [],
spaceName: [],
merchantName: [],
},
}
},
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/VenueReservationRecord/' + id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
});
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/example/VenueReservationRecord/' + 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/VenueReservationRecord',
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/VenueReservationRecord/' + 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,481 @@
<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="提交日期">
<JnpfDateRangePicker v-model="query.creationTime" format="yyyy-MM-dd"
startPlaceholder="开始日期" endPlaceholder="结束日期" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="商户名称">
<el-input v-model="query.merchantName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="空间名称">
<el-input v-model="query.spaceName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="预约进度">
<JnpfSelect v-model="query.usageProgress" placeholder="请选择预约进度" clearable
:options="usageProgressOptions" :props="usageProgressProps" multiple>
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<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-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">
展开
</el-button>
<el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
收起
</el-button>
</el-form-item>
</el-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="success" icon="icon-ym icon-ym-btn-download" @click="exportData()">
</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'
:span-method="arraySpanMethod">
<el-table-column prop="applicationNumber" label="申请单号" align="left">
</el-table-column>
<el-table-column prop="merchantId" label="商户名称" align="left">
</el-table-column>
<el-table-column prop="spaceId" label="空间名称" align="left">
</el-table-column>
<el-table-column prop="contacts" label="联系人" align="left">
</el-table-column>
<el-table-column prop="contactsPhone" label="联系电话" align="left">
</el-table-column>
<el-table-column prop="reservationsThing" label="预约事由" align="left">
</el-table-column>
<el-table-column prop="reservationsNumber" label="预约人数" align="left">
</el-table-column>
<el-table-column label="预约进度" prop="usageProgress" algin="left">
<template slot-scope="scope">
{{ scope.row.usageProgress }}
</template>
</el-table-column>
<el-table-column prop="startTime" label="开始时间" align="left">
</el-table-column>
<el-table-column prop="endTime" label="结束时间" align="left">
</el-table-column>
<el-table-column 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,
showAll: false,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
creationTime: undefined,
merchantName: undefined,
spaceName: undefined,
usageProgress: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
usageProgressOptions: [{ "fullName": "预约中", "id": "1" }, { "fullName": "已结束", "id": "2" }],
usageProgressProps: { "label": "fullName", "value": "id" },
interfaceRes: {
merchantId: [],
spaceId: [],
},
}
},
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: '583566974336893829',
type: 1,
};
request({
url: `/api/example/VenueReservationRecord/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/VenueReservationRecord/${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/VenueReservationRecord")
})
},
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/VenueReservationRecord/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