合同条款

jg-waiwang-pro
mhsnet 9 months ago
parent f9568315d7
commit 383ee5ee6c

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

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

@ -5,11 +5,11 @@ import jnpf.entity.ContractClauseEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/** /**
* ContractClause * contractClause
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-01-23 * 2024-02-02
*/ */
public interface ContractClauseMapper extends BaseMapper<ContractClauseEntity> { public interface ContractClauseMapper extends BaseMapper<ContractClauseEntity> {

@ -0,0 +1,18 @@
package jnpf.service;
import jnpf.model.contractclause.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* contractClause
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
*/
public interface ContractClauseFieldsService extends IService<ContractClauseFieldsEntity> {
QueryWrapper<ContractClauseFieldsEntity> getChild(ContractClausePagination pagination,QueryWrapper<ContractClauseFieldsEntity> contractClauseFieldsQueryWrapper);
}

@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/** /**
* ContractClause * contractClause
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-01-23 * 2024-02-02
*/ */
public interface ContractClauseService extends IService<ContractClauseEntity> { public interface ContractClauseService extends IService<ContractClauseEntity> {
List<ContractClauseEntity> getList(ContractClausePagination contractClausePagination); List<ContractClauseEntity> getList(ContractClausePagination contractClausePagination);
@ -27,6 +27,10 @@ public interface ContractClauseService extends IService<ContractClauseEntity> {
boolean update(String id, ContractClauseEntity entity); boolean update(String id, ContractClauseEntity entity);
//子表方法 //子表方法
List<ContractClauseFieldsEntity> getContractClauseFieldsList(String id,ContractClausePagination contractClausePagination);
List<ContractClauseFieldsEntity> getContractClauseFieldsList(String id);
//副表数据方法 //副表数据方法
String checkForm(ContractClauseForm form,int i); String checkForm(ContractClauseForm form,int i);

@ -0,0 +1,59 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ContractClauseFieldsMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.contractclause.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* contractClause
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
*/
@Service
public class ContractClauseFieldsServiceImpl extends ServiceImpl<ContractClauseFieldsMapper, ContractClauseFieldsEntity> implements ContractClauseFieldsService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
//子表过滤方法
@Override
public QueryWrapper<ContractClauseFieldsEntity> getChild(ContractClausePagination pagination, QueryWrapper<ContractClauseFieldsEntity> contractClauseFieldsQueryWrapper){
boolean pcPermission = true;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
String ruleQueryJson = isPc?ContractClauseConstant.getColumnData():ContractClauseConstant.getAppColumnData();
ColumnDataModel dataModel = JsonUtil.getJsonToBean(ruleQueryJson,ColumnDataModel.class);
String ruleJson = isPc?JsonUtil.getObjectToString(dataModel.getRuleList()):JsonUtil.getObjectToString(dataModel.getRuleListApp());
if(isPc){
}
return contractClauseFieldsQueryWrapper;
}
}

@ -32,11 +32,11 @@ import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity; import jnpf.permission.entity.UserEntity;
/** /**
* *
* ContractClause * contractClause
* V3.5 * V3.5
* https://www.jnpfsoft.com * https://www.jnpfsoft.com
* JNPF * JNPF
* 2024-01-23 * 2024-02-02
*/ */
@Service @Service
public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper, ContractClauseEntity> implements ContractClauseService{ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper, ContractClauseEntity> implements ContractClauseService{
@ -46,6 +46,8 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
@Autowired @Autowired
private UserProvider userProvider; private UserProvider userProvider;
@Autowired
private ContractClauseFieldsService contractClauseFieldsService;
@Override @Override
public List<ContractClauseEntity> getList(ContractClausePagination contractClausePagination){ public List<ContractClauseEntity> getList(ContractClausePagination contractClausePagination){
return getTypeList(contractClausePagination,contractClausePagination.getDataType()); return getTypeList(contractClausePagination,contractClausePagination.getDataType());
@ -64,6 +66,9 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
int total=0; int total=0;
int contractClauseNum =0; int contractClauseNum =0;
QueryWrapper<ContractClauseEntity> contractClauseQueryWrapper=new QueryWrapper<>(); QueryWrapper<ContractClauseEntity> contractClauseQueryWrapper=new QueryWrapper<>();
int contractClauseFieldsNum =0;
QueryWrapper<ContractClauseFieldsEntity> contractClauseFieldsQueryWrapper=new QueryWrapper<>();
long contractClauseFieldscount = contractClauseFieldsService.count();
List<String> allSuperIDlist = new ArrayList<>(); List<String> allSuperIDlist = new ArrayList<>();
String superOp =""; String superOp ="";
if (ObjectUtil.isNotEmpty(contractClausePagination.getSuperQueryJson())){ if (ObjectUtil.isNotEmpty(contractClausePagination.getSuperQueryJson())){
@ -81,6 +86,14 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
intersectionSuperList.add(contractClauseList); intersectionSuperList.add(contractClauseList);
superNum++; superNum++;
} }
String contractClauseFieldsTable = "jg_contract_clause_fields";
boolean contractClauseFieldsHasSql = queryJson.contains(contractClauseFieldsTable);
List<String> contractClauseFieldsList = generaterSwapUtil.selectIdsByChildCondition(ContractClauseConstant.getTableList(), contractClauseFieldsTable , queryJson, null);
if (contractClauseFieldsHasSql){
allSuperList.addAll(contractClauseFieldsList);
intersectionSuperList.add(contractClauseFieldsList);
superNum++;
}
superOp = superNum > 0 ? superJsonModel.getMatchLogic() : ""; superOp = superNum > 0 ? superJsonModel.getMatchLogic() : "";
//and or //and or
if(superOp.equalsIgnoreCase("and")){ if(superOp.equalsIgnoreCase("and")){
@ -105,6 +118,14 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
intersectionRuleList.add(contractClauseList); intersectionRuleList.add(contractClauseList);
ruleNum++; ruleNum++;
} }
String contractClauseFieldsTable = "jg_contract_clause_fields";
boolean contractClauseFieldsHasSql = ruleJson.contains(contractClauseFieldsTable);
List<String> contractClauseFieldsList = generaterSwapUtil.selectIdsByChildCondition(ContractClauseConstant.getTableList(), contractClauseFieldsTable , ruleJson, null);
if (contractClauseFieldsHasSql){
allRuleList.addAll(contractClauseFieldsList);
intersectionRuleList.add(contractClauseFieldsList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : ""; ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or //and or
if(ruleOp.equalsIgnoreCase("and")){ if(ruleOp.equalsIgnoreCase("and")){
@ -113,7 +134,7 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
allRuleIDlist = allRuleList; allRuleIDlist = allRuleList;
} }
} }
boolean pcPermission = false; boolean pcPermission = true;
boolean appPermission = false; boolean appPermission = false;
if(isPc && pcPermission){ if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){ if (!userProvider.get().getIsAdministrator()){
@ -126,6 +147,15 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
contractClauseNum++; contractClauseNum++;
} }
} }
Object contractClauseFieldsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(contractClauseFieldsQueryWrapper,ContractClauseFieldsEntity.class,contractClausePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(contractClauseFieldsObj)){
return new ArrayList<>();
} else {
contractClauseFieldsQueryWrapper = (QueryWrapper<ContractClauseFieldsEntity>)contractClauseFieldsObj;
if( contractClauseFieldsQueryWrapper.getExpression().getNormal().size()>0){
contractClauseFieldsNum++;
}
}
} }
} }
if(!isPc && appPermission){ if(!isPc && appPermission){
@ -141,6 +171,17 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
} }
Object contractClauseFieldsObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(contractClauseFieldsQueryWrapper,ContractClauseFieldsEntity.class,contractClausePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(contractClauseFieldsObj)){
return new ArrayList<>();
} else {
contractClauseFieldsQueryWrapper = (QueryWrapper<ContractClauseFieldsEntity>)contractClauseFieldsObj;
if( contractClauseFieldsQueryWrapper.getExpression().getNormal().size()>0){
contractClauseFieldsNum++;
}
}
} }
} }
if(isPc){ if(isPc){
@ -154,13 +195,10 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
} }
if(ObjectUtil.isNotEmpty(contractClausePagination.getContent())){ if(ObjectUtil.isNotEmpty(contractClausePagination.getContractType())){
contractClauseNum++; contractClauseNum++;
String value = contractClausePagination.getContent() instanceof List ? contractClauseQueryWrapper.lambda().eq(ContractClauseEntity::getContractType,contractClausePagination.getContractType());
JsonUtil.getObjectToString(contractClausePagination.getContent()) :
String.valueOf(contractClausePagination.getContent());
contractClauseQueryWrapper.lambda().like(ContractClauseEntity::getContent,value);
} }
@ -179,6 +217,15 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
} }
} }
if(contractClauseFieldsNum>0){
List<String> contractClauseFieldsIdList = contractClauseFieldsService.list(contractClauseFieldsQueryWrapper).stream().filter(t->StringUtil.isNotEmpty(t.getContractClauseId())).map(t->t.getContractClauseId()).collect(Collectors.toList());
long count = contractClauseFieldsService.count();
if (count>0){
intersectionList.add(contractClauseFieldsIdList);
}
AllIdList.addAll(contractClauseFieldsIdList);
}
total+=contractClauseFieldsNum;
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList); List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){ if (total>0){
if (intersection.size()==0){ if (intersection.size()==0){
@ -202,6 +249,8 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
List<String> finalAllRuleIDlist = allRuleIDlist; List<String> finalAllRuleIDlist = allRuleIDlist;
contractClauseQueryWrapper.lambda().and(t->t.in(ContractClauseEntity::getId, finalAllRuleIDlist)); contractClauseQueryWrapper.lambda().and(t->t.in(ContractClauseEntity::getId, finalAllRuleIDlist));
} }
//假删除标志
contractClauseQueryWrapper.lambda().isNull(ContractClauseEntity::getDeleteMark);
//排序 //排序
if(StringUtil.isEmpty(contractClausePagination.getSidx())){ if(StringUtil.isEmpty(contractClausePagination.getSidx())){
@ -253,6 +302,27 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
this.removeById(entity.getId()); this.removeById(entity.getId());
} }
} }
/** ContractClauseFields子表方法 */
@Override
public List<ContractClauseFieldsEntity> getContractClauseFieldsList(String id,ContractClausePagination contractClausePagination){
Map<String, Object> newtabMap=ContractClauseConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="contractClauseFields";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<ContractClauseFieldsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = contractClauseFieldsService.getChild(contractClausePagination,queryWrapper);
queryWrapper.lambda().eq(ContractClauseFieldsEntity::getContractClauseId, id);
generaterSwapUtil.wrapperHandle(ContractClauseConstant.getColumnData(), ContractClauseConstant.getAppColumnData(), queryWrapper,ContractClauseFieldsEntity.class,"sub",tableName);
return contractClauseFieldsService.list(queryWrapper);
}
/** ContractClauseFields子表方法 */
@Override
public List<ContractClauseFieldsEntity> getContractClauseFieldsList(String id){
QueryWrapper<ContractClauseFieldsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractClauseFieldsEntity::getContractClauseId, id);
return contractClauseFieldsService.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/ /** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override @Override
public String checkForm(ContractClauseForm form,int i) { public String checkForm(ContractClauseForm form,int i) {
@ -266,6 +336,9 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
if(StringUtil.isEmpty(form.getTitle())){ if(StringUtil.isEmpty(form.getTitle())){
return "条款标题不能为空"; return "条款标题不能为空";
} }
//子表字段验证
if (form.getContractClauseFieldsList()!=null){
}
return countRecover; return countRecover;
} }
/** /**
@ -286,9 +359,27 @@ public class ContractClauseServiceImpl extends ServiceImpl<ContractClauseMapper,
if(isSave){ if(isSave){
String mainId = RandomUtil.uuId() ; String mainId = RandomUtil.uuId() ;
entity.setId(mainId); entity.setId(mainId);
entity.setVersion(0);
}else{ }else{
} }
this.saveOrUpdate(entity); this.saveOrUpdate(entity);
//ContractClauseFields子表数据新增修改
if(!isSave){
QueryWrapper<ContractClauseFieldsEntity> ContractClauseFieldsqueryWrapper = new QueryWrapper<>();
ContractClauseFieldsqueryWrapper.lambda().eq(ContractClauseFieldsEntity::getContractClauseId, entity.getId());
contractClauseFieldsService.remove(ContractClauseFieldsqueryWrapper);
}
if (contractClauseForm.getContractClauseFieldsList()!=null){
List<ContractClauseFieldsEntity> tableField113 = JsonUtil.getJsonToList(contractClauseForm.getContractClauseFieldsList(),ContractClauseFieldsEntity.class);
for(ContractClauseFieldsEntity entitys : tableField113){
entitys.setId(RandomUtil.uuId());
entitys.setContractClauseId(entity.getId());
if(isSave){
}else{
}
contractClauseFieldsService.saveOrUpdate(entitys);
}
}
} }
} }

@ -27,18 +27,38 @@ import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; 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; import org.springframework.transaction.annotation.Transactional;
/** /**
* ContractClause * contractClause
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-01-23 * @ 2024-02-02
*/ */
@Slf4j @Slf4j
@RestController @RestController
@Tag(name = "ContractClause" , description = "scm") @Tag(name = "contractClause" , description = "scm")
@RequestMapping("/api/scm/ContractClause") @RequestMapping("/api/scm/ContractClause")
public class ContractClauseController { public class ContractClauseController {
@ -51,7 +71,12 @@ public class ContractClauseController {
@Autowired @Autowired
private ContractClauseService contractClauseService; private ContractClauseService contractClauseService;
@Autowired
private ContractClauseFieldsService contractClauseFieldsService;
@Autowired
private ConfigValueUtil configValueUtil;
/** /**
* *
@ -69,6 +94,8 @@ public class ContractClauseController {
contractClauseMap.put("id", contractClauseMap.get("id")); contractClauseMap.put("id", contractClauseMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
List<ContractClauseFieldsEntity> contractClauseFieldsList = contractClauseService.getContractClauseFieldsList(entity.getId(),contractClausePagination);
contractClauseMap.put("tableField113",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(contractClauseFieldsList)));
realList.add(contractClauseMap); realList.add(contractClauseMap);
} }
//数据转换 //数据转换
@ -102,6 +129,166 @@ public class ContractClauseController {
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }
/** /**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody ContractClausePagination contractClausePagination) throws IOException {
if (StringUtil.isEmpty(contractClausePagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<ContractClauseEntity> list= contractClauseService.getList(contractClausePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ContractClauseEntity entity : list) {
Map<String, Object> contractClauseMap=JsonUtil.entityToMap(entity);
contractClauseMap.put("id", contractClauseMap.get("id"));
//副表数据
//子表数据
List<ContractClauseFieldsEntity> contractClauseFieldsList = contractClauseService.getContractClauseFieldsList(entity.getId(),contractClausePagination);
contractClauseMap.put("tableField113",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(contractClauseFieldsList)));
realList.add(contractClauseMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ContractClauseConstant.getFormData(), ContractClauseConstant.getColumnData(), contractClausePagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(contractClausePagination.getSelectKey())?contractClausePagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
ExcelExportEntity tableField113ExcelEntity = new ExcelExportEntity("条款内控制字段","tableField113");
List<ExcelExportEntity> tableField113List = new ArrayList<>();
for(String key:keys){
switch(key){
case "contractType" :
entitys.add(new ExcelExportEntity("条款合同类型" ,"contractType"));
break;
case "title" :
entitys.add(new ExcelExportEntity("条款标题" ,"title"));
break;
case "content" :
entitys.add(new ExcelExportEntity("条款内容" ,"content"));
break;
case "attachment" :
entitys.add(new ExcelExportEntity("上传附件" ,"attachment"));
break;
case "type" :
entitys.add(new ExcelExportEntity("条款类型" ,"type"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "status" :
entitys.add(new ExcelExportEntity("状态" ,"status"));
break;
case "tableField113-tbKey":
tableField113List.add(new ExcelExportEntity("字段" ,"tbKey"));
break;
case "tableField113-tbTitle":
tableField113List.add(new ExcelExportEntity("标题" ,"tbTitle"));
break;
case "tableField113-sort":
tableField113List.add(new ExcelExportEntity("排序" ,"sort"));
break;
default:
break;
}
}
if(tableField113List.size() > 0){
tableField113ExcelEntity.setList(tableField113List);
entitys.add(tableField113ExcelEntity);
}
}
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(ContractClauseConstant.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 ids
* @return
*/
@DeleteMapping("/batchRemove")
@Transactional
@Operation(summary = "批量删除")
public ActionResult batchRemove(@RequestBody String ids){
List<String> idList = JsonUtil.getJsonToList(ids, String.class);
int i =0;
for (String allId : idList){
this.delete(allId);
i++;
}
if (i == 0 ){
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
}
/**
* *
* @param id * @param id
* @param contractClauseForm * @param contractClauseForm
@ -141,8 +328,9 @@ public class ContractClauseController {
public ActionResult delete(@PathVariable("id") String id){ public ActionResult delete(@PathVariable("id") String id){
ContractClauseEntity entity= contractClauseService.getInfo(id); ContractClauseEntity entity= contractClauseService.getInfo(id);
if(entity!=null){ if(entity!=null){
//主表数据删除 //假删除
contractClauseService.delete(entity); entity.setDeleteMark(1);
contractClauseService.update(id,entity);
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
@ -163,6 +351,8 @@ public class ContractClauseController {
contractClauseMap.put("id", contractClauseMap.get("id")); contractClauseMap.put("id", contractClauseMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
List<ContractClauseFieldsEntity> contractClauseFieldsList = contractClauseService.getContractClauseFieldsList(entity.getId());
contractClauseMap.put("tableField113",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(contractClauseFieldsList)));
contractClauseMap = generaterSwapUtil.swapDataDetail(contractClauseMap,ContractClauseConstant.getFormData(),"519502523443183621",false); contractClauseMap = generaterSwapUtil.swapDataDetail(contractClauseMap,ContractClauseConstant.getFormData(),"519502523443183621",false);
return ActionResult.success(contractClauseMap); return ActionResult.success(contractClauseMap);
} }
@ -183,6 +373,8 @@ public class ContractClauseController {
contractClauseMap.put("id", contractClauseMap.get("id")); contractClauseMap.put("id", contractClauseMap.get("id"));
//副表数据 //副表数据
//子表数据 //子表数据
List<ContractClauseFieldsEntity> contractClauseFieldsList = contractClauseService.getContractClauseFieldsList(entity.getId());
contractClauseMap.put("contractClauseFieldsList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(contractClauseFieldsList)));
contractClauseMap = generaterSwapUtil.swapDataForm(contractClauseMap,ContractClauseConstant.getFormData(),ContractClauseConstant.TABLEFIELDKEY,ContractClauseConstant.TABLERENAMES); contractClauseMap = generaterSwapUtil.swapDataForm(contractClauseMap,ContractClauseConstant.getFormData(),ContractClauseConstant.TABLEFIELDKEY,ContractClauseConstant.TABLERENAMES);
return ActionResult.success(contractClauseMap); return ActionResult.success(contractClauseMap);
} }

@ -4,12 +4,12 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
/** /**
* *
* *
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-01-23 * @ 2024-02-02
*/ */
@Data @Data
@TableName("jg_contract_clause") @TableName("jg_contract_clause")
@ -18,6 +18,8 @@ public class ContractClauseEntity {
private String id; private String id;
@TableField(value = "TITLE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "TITLE" , updateStrategy = FieldStrategy.IGNORED)
private String title; private String title;
@TableField(value = "CONTRACT_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String contractType;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type; private String type;
@TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "STATUS" , updateStrategy = FieldStrategy.IGNORED)
@ -30,8 +32,6 @@ public class ContractClauseEntity {
private String remark; private String remark;
@TableField(value = "ATTACHMENT" , updateStrategy = FieldStrategy.IGNORED) @TableField(value = "ATTACHMENT" , updateStrategy = FieldStrategy.IGNORED)
private String attachment; private String attachment;
@TableField(value = "EFFECTIVE_DATE" , updateStrategy = FieldStrategy.IGNORED)
private Date effectiveDate;
@TableField("F_CREATOR_TIME") @TableField("F_CREATOR_TIME")
private Date creatorTime; private Date creatorTime;
@TableField("F_CREATOR_USER_ID") @TableField("F_CREATOR_USER_ID")
@ -50,4 +50,6 @@ public class ContractClauseEntity {
private String tenantId; private String tenantId;
@TableField("F_FLOW_ID") @TableField("F_FLOW_ID")
private String flowId; private String flowId;
@TableField("F_VERSION")
private Integer version;
} }

@ -0,0 +1,47 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* ()
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
*/
@Data
@TableName("jg_contract_clause_fields")
public class ContractClauseFieldsEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "TB_KEY" , updateStrategy = FieldStrategy.IGNORED)
private String tbKey;
@TableField(value = "TB_TITLE" , updateStrategy = FieldStrategy.IGNORED)
private String tbTitle;
@TableField(value = "SORT" , updateStrategy = FieldStrategy.IGNORED)
private Integer sort;
@TableField("CONTRACT_CLAUSE_ID")
private String contractClauseId;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,31 @@
package jnpf.model.contractclause;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* contractClause
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-02
*/
@Data
public class ContractClauseFieldsModel {
/** 字段 **/
@JSONField(name = "tbKey")
private String tbKey;
/** 标题 **/
@JSONField(name = "tbTitle")
private String tbTitle;
/** 排序 **/
@JSONField(name = "sort")
private BigDecimal sort;
}

@ -6,32 +6,38 @@ import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* ContractClause * contractClause
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-01-23 * @ 2024-02-02
*/ */
@Data @Data
public class ContractClauseForm { public class ContractClauseForm {
/** 主键 */ /** 主键 */
private String id; private String id;
/** 子表数据 **/
@JsonProperty("contractClauseFieldsList")
private List<ContractClauseFieldsModel> contractClauseFieldsList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 条款类型 **/ /** 条款合同类型 **/
@JsonProperty("type") @JsonProperty("contractType")
private String type; private String contractType;
/** 生效日期 **/
@JsonProperty("effectiveDate")
private String effectiveDate;
/** 条款标题 **/ /** 条款标题 **/
@JsonProperty("title") @JsonProperty("title")
private String title; private String title;
/** 条款内容 **/ /** 条款内容 **/
@JsonProperty("content") @JsonProperty("content")
private String content; private String content;
/** 附件 **/ /** 上传附件 **/
@JsonProperty("attachment") @JsonProperty("attachment")
private Object attachment; private Object attachment;
/** 条款类型 **/
@JsonProperty("type")
private String type;
/** 备注 **/ /** 备注 **/
@JsonProperty("remark") @JsonProperty("remark")
private String remark; private String remark;

@ -7,11 +7,11 @@ import java.util.List;
/** /**
* *
* ContractClause * contractClause
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
* @ 2024-01-23 * @ 2024-02-02
*/ */
@Data @Data
public class ContractClausePagination extends Pagination { public class ContractClausePagination extends Pagination {
@ -30,9 +30,9 @@ public class ContractClausePagination extends Pagination {
/** 条款标题 */ /** 条款标题 */
@JsonProperty("title") @JsonProperty("title")
private Object title; private Object title;
/** 条款内容 */ /** 条款合同类型 */
@JsonProperty("content") @JsonProperty("contractType")
private Object content; private Object contractType;
/** 条款类型 */ /** 条款类型 */
@JsonProperty("type") @JsonProperty("type")
private Object type; private Object type;

@ -0,0 +1,174 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
<div class="JNPF-common-page-header">
<el-page-header @back="goBack"
content="详情"/>
<div class="options">
<el-button @click="goBack"></el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="24" >
<jnpf-form-tip-item label="条款合同类型"
prop="contractType" >
<p>{{dataForm.contractType}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="条款标题"
prop="title" >
<p>{{dataForm.title}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="条款内容"
prop="content" >
<p>{{dataForm.content}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="上传附件"
prop="attachment" >
<JnpfUploadFile v-model="dataForm.attachment"
disabled
detailed :fileSize="20" sizeUnit="MB" :limit="9" pathType="defaultPath" :isAccount="0" buttonText="点击上传" >
</JnpfUploadFile>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="条款类型"
prop="type" tip-label="1.普通条款(直接输出内容条款) 2.商品条款(可根据子表添加商品表格显示)" >
<p>{{dataForm.type}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>条款内控制字段</h2>
</div>
<el-table :data="dataForm.tableField113" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="tbKey" label="字段" >
<template slot-scope="scope">
<p>{{scope.row.tbKey}}</p>
</template>
</el-table-column>
<el-table-column prop="tbTitle" label="标题" >
<template slot-scope="scope">
<p>{{scope.row.tbTitle}}</p>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" >
<template slot-scope="scope">
<JnpfNumber v-model="scope.row.sort"
placeholder="数字文本" disabled
:step="1" >
</JnpfNumber>
</template>
</el-table-column>
</el-table>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="状态"
prop="status" >
<p>{{dataForm.status}}</p>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
contractType : "1",
title : '',
content : "",
attachment : [],
type : "1",
remark : '',
status : "1",
contractclausefieldsList:[],
},
contractTypeProps:{"label":"fullName","value":"enCode" },
typeProps:{"label":"fullName","value":"enCode" },
statusProps:{"label":"fullName","value":"enCode" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
goBack() {
this.$emit('refresh')
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/ContractClause/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,597 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
<div class="options">
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"
:disabled='continueBtnLoading'> </el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24">
<jnpf-form-tip-item label="条款合同类型" prop="contractType">
<JnpfRadio v-model="dataForm.contractType" @change="changeData('contractType', -1)"
optionType="default" direction="horizontal" :style='{ "width": "100%" }' size="default"
:options="contractTypeOptions" :props="contractTypeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="条款标题" prop="title">
<JnpfInput v-model="dataForm.title" @change="changeData('title', -1)" placeholder="请输入"
clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="条款内容" prop="content">
<JnpfEditor v-model="dataForm.content" @change="changeData('content', -1)" placeholder="请输入"
:style='{ "width": "100%" }'>
</JnpfEditor>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="上传附件" prop="attachment">
<JnpfUploadFile v-model="dataForm.attachment" @change="changeData('attachment', -1)"
tipText="支持格式:.rar .zip .doc .docx .pdf 单个文件不能超过20MB" :fileSize="20" sizeUnit="MB"
:limit="9" pathType="defaultPath" :isAccount="0" buttonText="点击上传">
</JnpfUploadFile>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="条款类型" tipLabel="1.普通条款(直接输出内容条款) 2.商品条款(可根据子表添加商品表格显示)" prop="type">
<JnpfRadio v-model="dataForm.type" @change="changeData('type', -1)" optionType="default"
direction="horizontal" size="small" :options="typeOptions" :props="typeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>条款内控制字段</h2>
</div>
<el-table :data="dataForm.contractClauseFieldsList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="字段" prop="tbKey">
<template slot="header" v-if="false">
<span class="required-sign">*</span>字段
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.tbKey"
@change="changeData('contractclausefields-tbKey', scope.$index)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="标题" prop="tbTitle">
<template slot="header" v-if="false">
<span class="required-sign">*</span>标题
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.tbTitle"
@change="changeData('contractclausefields-tbTitle', scope.$index)"
placeholder="请输入" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="排序" prop="sort">
<template slot="header" v-if="false">
<span class="required-sign">*</span>排序
</template>
<template slot-scope="scope">
<JnpfInputNumber v-model="scope.row.sort"
@change="changeData('contractclausefields-sort', scope.$index)"
placeholder="数字文本" :step="1">
</JnpfInputNumber>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delcontractclausefieldsList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addcontractclausefieldsList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="备注" prop="remark">
<JnpfTextarea v-model="dataForm.remark" @change="changeData('remark', -1)" placeholder="请输入"
:maxlength="200" clearable :style='{ "width": "100%" }'
:autosize='{ "minRows": 4, "maxRows": 4 }'>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="状态" prop="status">
<JnpfRadio v-model="dataForm.status" @change="changeData('status', -1)" optionType="default"
direction="horizontal" :style='{ "width": "100%" }' size="default" :options="statusOptions"
:props="statusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: {},
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting: {},
eventType: '',
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
contractClauseFieldsList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
},
//
ableAll: {
},
tableRows: {
contractClauseFieldsList: {
tbKey: '',
tbKeyOptions: [],
tbTitle: '',
tbTitleOptions: [],
sort: undefined,
sortOptions: [],
enabledmark: undefined
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
contractType: "1",
title: undefined,
content: undefined,
attachment: [],
type: "1",
remark: undefined,
status: "1",
contractClauseFieldsList: [],
version: 0,
},
tableRequiredData: {},
dataRule:
{
contractType: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
title: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
content: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
type: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
contractTypeOptions: [],
contractTypeProps: { "label": "fullName", "value": "enCode" },
typeOptions: [],
typeProps: { "label": "fullName", "value": "enCode" },
statusOptions: [],
statusProps: { "label": "fullName", "value": "enCode" },
childIndex: -1,
isEdit: false,
interfaceRes: {
contractType: [],
title: [],
content: [],
attachment: [],
type: [],
remark: [],
status: [],
contractclausefieldstbKey: [],
contractclausefieldstbTitle: [],
contractclausefieldssort: [],
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() { },
methods: {
prev() {
this.index--
if (this.index === 0) {
this.prevDis = true
}
this.nextDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
next() {
this.index++
if (this.index === this.allList.length - 1) {
this.nextDis = true
}
this.prevDis = false
for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index];
if (this.index == index) {
this.getInfo(element.id)
}
}
},
getInfo(id) {
request({
url: '/api/scm/ContractClause/' + 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() {
this.getcontractTypeOptions();
this.gettypeOptions();
this.getstatusOptions();
},
contractclausefieldsExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.contractClauseFieldsList.length; i++) {
const e = this.dataForm.contractClauseFieldsList[i];
}
return isOk;
},
getcontractTypeOptions() {
getDictionaryDataSelector('519483543638772229').then(res => {
this.contractTypeOptions = res.data.list
})
},
gettypeOptions() {
getDictionaryDataSelector('520239598056505413').then(res => {
this.typeOptions = res.data.list
})
},
getstatusOptions() {
getDictionaryDataSelector('519495883595713029').then(res => {
this.statusOptions = res.data.list
})
},
goBack() {
this.$emit('refresh')
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/scm/ContractClause/' + 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) {
if (!this.contractclausefieldsExist()) return
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/ContractClause',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
} else {
request({
url: '/api/scm/ContractClause/' + 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
})
}
},
addcontractclausefieldsList() {
let item = {
tbKey: undefined,
tbTitle: undefined,
sort: 0,
}
this.getcontractclausefieldsList(item)
},
delcontractclausefieldsList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.contractClauseFieldsList.splice(index, 1);
}).catch(() => {
});
},
getcontractclausefieldsList(value) {
let item = { ...this.tableRows.contractClauseFieldsList, ...value }
this.dataForm.contractClauseFieldsList.push(item)
this.childIndex = this.dataForm.contractClauseFieldsList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
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()
for (let i = 0; i < _dataAll.contractClauseFieldsList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
},
},
}
</script>

@ -0,0 +1,535 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="条款标题">
<el-input v-model="query.title" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="条款合同类型">
<JnpfSelect v-model="query.contractType" placeholder="请选择" clearable
:options="contractTypeOptions" :props="contractTypeProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="条款类型">
<JnpfSelect v-model="query.type" placeholder="请选择" clearable :options="typeOptions"
:props="typeProps">
</JnpfSelect>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="条款状态">
<JnpfSelect v-model="query.status" placeholder="请选择" clearable :options="statusOptions"
:props="statusProps">
</JnpfSelect>
</el-form-item>
</el-col>
</template>
<el-col :span="6">
<el-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" v-has="'btn_add'"
@click="addOrUpdateHandle()">新增
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()"
v-has="'btn_download'">导出
</el-button>
<el-button type="text" icon="icon-ym icon-ym-btn-clearn" @click="handleBatchRemoveDel()"
v-has="'btn_batchRemove'">批量删除
</el-button>
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@click="openSuperQuery()" />
</el-tooltip>
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
</el-tooltip>
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="title" label="条款标题" align="left">
</el-table-column>
<el-table-column prop="contractType" label="条款合同类型" align="left">
</el-table-column>
<el-table-column prop="type" label="条款类型" align="left">
</el-table-column>
<el-table-column prop="remark" label="备注" align="left">
</el-table-column>
<el-table-column prop="status" label="状态" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">
</el-button>
<el-button type="text" class="JNPF-table-delBtn" v-has="'btn_remove'"
@click="handleDel(scope.row.id)">删除
</el-button>
<el-button type="text" v-has="'btn_detail'" @click="goDetail(scope.row.id)">
</el-button>
</template>
</el-table-column>
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
@pagination="initData" />
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible = false" />
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail" @close="toFormDetailVisible = false" />
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson" @superQuery="superQuery" />
</div>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import JNPFForm from './form'
import Detail from './Detail'
import ExportBox from '@/components/ExportBox'
import ToFormDetail from '@/views/basic/dynamicModel/list/detail'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getConfigData } from '@/api/onlineDev/visualDev'
import { getDefaultCurrentValueUserIdAsync } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentIdAsync } from '@/api/permission/organize'
import columnList from './columnList'
import { thousandsFormat } from "@/components/Generator/utils/index"
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
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: {
title: undefined,
contractType: undefined,
type: undefined,
status: undefined,
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf'
},
list: [],
listLoading: true,
multipleSelection: [], total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: "desc",
sidx: "",
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
contractTypeOptions: [],
contractTypeProps: { "label": "fullName", "value": "enCode" },
typeOptions: [],
typeProps: { "label": "fullName", "value": "enCode" },
statusOptions: [],
statusProps: { "label": "fullName", "value": "enCode" },
interfaceRes: {
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.getcontractTypeOptions();
this.gettypeOptions();
this.getstatusOptions();
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
},
getcontractTypeOptions() {
getDictionaryDataSelector('519483543638772229').then(res => {
this.contractTypeOptions = res.data.list
})
},
gettypeOptions() {
getDictionaryDataSelector('520239598056505413').then(res => {
this.typeOptions = res.data.list
})
},
getstatusOptions() {
getDictionaryDataSelector('519495883595713029').then(res => {
this.statusOptions = res.data.list
})
},
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: '519502523443183621',
};
request({
url: `/api/scm/ContractClause/getList`,
method: 'post',
data: _query
}).then(res => {
var _list = res.data.list;
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/ContractClause/${id}`,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
});
},
handelUpload() {
this.uploadBoxVisible = true
this.$nextTick(() => {
this.$refs.UploadBox.init("", "scm/ContractClause")
})
},
handleSelectionChange(val) {
const res = val.map(item => item.id)
this.multipleSelection = res
},
handleBatchRemoveDel() {
if (!this.multipleSelection.length) {
this.$message({
type: 'error',
message: '请选择一条数据',
duration: 1500,
})
return
}
const ids = this.multipleSelection
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
request({
url: `/api/scm/ContractClause/batchRemove`,
data: ids,
method: 'DELETE'
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
}
});
})
}).catch(() => {
})
},
openSuperQuery() {
this.superQueryVisible = true
this.$nextTick(() => {
this.$refs.SuperQuery.init()
})
},
superQuery(queryJson) {
this.listQuery.superQueryJson = queryJson
this.listQuery.currentPage = 1
this.initData()
},
addOrUpdateHandle(row, isDetail) {
let id = row ? row.id : ""
this.formVisible = true
this.$nextTick(() => {
this.$refs.JNPFForm.init(id, isDetail, this.list)
})
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = { ...data, ...this.listQuery, ...this.query, menuId: this.menuId }
request({
url: `/api/scm/ContractClause/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