新增费用单

jg-waiwang-pro
CJYXTX\27961 7 months ago
parent bd86446c9e
commit 2af278f0cf

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

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

@ -0,0 +1,35 @@
package jnpf.service;
import jnpf.model.cwcost.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* cwCost
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-26
*/
public interface CwCostService extends IService<CwCostEntity> {
List<CwCostEntity> getList(CwCostPagination cwCostPagination);
List<CwCostEntity> getTypeList(CwCostPagination cwCostPagination,String dataType);
CwCostEntity getInfo(String id);
void delete(CwCostEntity entity);
void create(CwCostEntity entity);
boolean update(String id, CwCostEntity entity);
//子表方法
//副表数据方法
String checkForm(CwCostForm form,int i);
void saveOrUpdate(CwCostForm cwCostForm,String id, boolean isSave) throws Exception;
}

@ -0,0 +1,360 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.CwCostMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.cwcost.*;
import java.math.BigDecimal;
import cn.hutool.core.util.ObjectUtil;
import jnpf.permission.model.authorize.AuthorizeConditionModel;
import jnpf.util.GeneraterSwapUtil;
import jnpf.database.model.superQuery.SuperQueryJsonModel;
import jnpf.database.model.superQuery.ConditionJsonModel;
import jnpf.database.model.superQuery.SuperQueryConditionModel;
import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField;
import java.util.regex.Pattern;
import jnpf.model.QueryModel;
import java.util.stream.Collectors;
import jnpf.base.model.ColumnDataModel;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jnpf.database.model.superQuery.SuperJsonModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import java.util.*;
import jnpf.base.UserInfo;
import jnpf.permission.entity.UserEntity;
/**
*
* cwCost
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-03-26
*/
@Service
public class CwCostServiceImpl extends ServiceImpl<CwCostMapper, CwCostEntity> implements CwCostService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Override
public List<CwCostEntity> getList(CwCostPagination cwCostPagination){
return getTypeList(cwCostPagination,cwCostPagination.getDataType());
}
/** 列表查询 */
@Override
public List<CwCostEntity> getTypeList(CwCostPagination cwCostPagination,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 ? CwCostConstant.getAppColumnData() : CwCostConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int cwCostNum =0;
QueryWrapper<CwCostEntity> cwCostQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(cwCostPagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = cwCostPagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<CwCostEntity> cwCostSuperWrapper = new QueryWrapper<>();
cwCostSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(cwCostSuperWrapper,CwCostEntity.class,queryJson,"0"));
int cwCostNum1 = cwCostSuperWrapper.getExpression().getNormal().size();
if (cwCostNum1>0){
List<String> cwCostList =this.list(cwCostSuperWrapper).stream().map(CwCostEntity::getId).collect(Collectors.toList());
allSuperList.addAll(cwCostList);
intersectionSuperList.add(cwCostList);
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<CwCostEntity> cwCostSuperWrapper = new QueryWrapper<>();
cwCostSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(cwCostSuperWrapper,CwCostEntity.class,ruleJson,"0"));
int cwCostNum1 = cwCostSuperWrapper.getExpression().getNormal().size();
if (cwCostNum1>0){
List<String> cwCostList =this.list(cwCostSuperWrapper).stream().map(CwCostEntity::getId).collect(Collectors.toList());
allRuleList.addAll(cwCostList);
intersectionRuleList.add(cwCostList);
ruleNum++;
}
ruleOp = ruleNum > 0 ? ruleJsonModel.getMatchLogic() : "";
//and or
if(ruleOp.equalsIgnoreCase("and")){
allRuleIDlist = generaterSwapUtil.getIntersection(intersectionRuleList);
}else{
allRuleIDlist = allRuleList;
}
}
boolean pcPermission = true;
boolean appPermission = false;
if(isPc && pcPermission){
if (!userProvider.get().getIsAdministrator()){
Object cwCostObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(cwCostQueryWrapper,CwCostEntity.class,cwCostPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(cwCostObj)){
return new ArrayList<>();
} else {
cwCostQueryWrapper = (QueryWrapper<CwCostEntity>)cwCostObj;
if( cwCostQueryWrapper.getExpression().getNormal().size()>0){
cwCostNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object cwCostObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(cwCostQueryWrapper,CwCostEntity.class,cwCostPagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(cwCostObj)){
return new ArrayList<>();
} else {
cwCostQueryWrapper = (QueryWrapper<CwCostEntity>)cwCostObj;
if( cwCostQueryWrapper.getExpression().getNormal().size()>0){
cwCostNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(cwCostPagination.getCode())){
cwCostNum++;
String value = cwCostPagination.getCode() instanceof List ?
JsonUtil.getObjectToString(cwCostPagination.getCode()) :
String.valueOf(cwCostPagination.getCode());
cwCostQueryWrapper.lambda().like(CwCostEntity::getCode,value);
}
if(ObjectUtil.isNotEmpty(cwCostPagination.getInstitutionId())){
cwCostNum++;
List<String> idList = new ArrayList<>();
try {
String[][] institutionId = JsonUtil.getJsonToBean(cwCostPagination.getInstitutionId(),String[][].class);
for(int i=0;i<institutionId.length;i++){
if(institutionId[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(institutionId[i])));
}
}
}catch (Exception e1){
try {
List<String> institutionId = JsonUtil.getJsonToList(cwCostPagination.getInstitutionId(),String.class);
if(institutionId.size()>0){
idList.add(JsonUtil.getObjectToString(institutionId));
}
}catch (Exception e2){
idList.add(String.valueOf(cwCostPagination.getInstitutionId()));
}
}
cwCostQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(CwCostEntity::getInstitutionId, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(cwCostPagination.getCostTime())){
cwCostNum++;
List CostTimeList = JsonUtil.getJsonToList(cwCostPagination.getCostTime(),String.class);
Long fir = Long.valueOf(String.valueOf(CostTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CostTimeList.get(1)));
cwCostQueryWrapper.lambda().ge(CwCostEntity::getCostTime, new Date(fir))
.le(CwCostEntity::getCostTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(cwCostPagination.getCostProject())){
cwCostNum++;
List<String> idList = new ArrayList<>();
try {
String[][] costProject = JsonUtil.getJsonToBean(cwCostPagination.getCostProject(),String[][].class);
for(int i=0;i<costProject.length;i++){
if(costProject[i].length>0){
idList.add(JsonUtil.getObjectToString(Arrays.asList(costProject[i])));
}
}
}catch (Exception e1){
try {
List<String> costProject = JsonUtil.getJsonToList(cwCostPagination.getCostProject(),String.class);
if(costProject.size()>0){
idList.add(JsonUtil.getObjectToString(costProject));
}
}catch (Exception e2){
idList.add(String.valueOf(cwCostPagination.getCostProject()));
}
}
cwCostQueryWrapper.lambda().and(t->{
idList.forEach(tt->{
t.like(CwCostEntity::getCostProject, tt).or();
});
});
}
if(ObjectUtil.isNotEmpty(cwCostPagination.getType())){
cwCostNum++;
cwCostQueryWrapper.lambda().eq(CwCostEntity::getType,cwCostPagination.getType());
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
cwCostQueryWrapper.lambda().in(CwCostEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
cwCostQueryWrapper.lambda().and(t->t.in(CwCostEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
cwCostQueryWrapper.lambda().and(t->t.in(CwCostEntity::getId, finalAllRuleIDlist));
}
//假删除标志
cwCostQueryWrapper.lambda().isNull(CwCostEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(cwCostPagination.getSidx())){
cwCostQueryWrapper.lambda().orderByDesc(CwCostEntity::getId);
}else{
try {
String sidx = cwCostPagination.getSidx();
String[] strs= sidx.split("_name");
CwCostEntity cwCostEntity = new CwCostEntity();
Field declaredField = cwCostEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
cwCostQueryWrapper="asc".equals(cwCostPagination.getSort().toLowerCase())?cwCostQueryWrapper.orderByAsc(value):cwCostQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<CwCostEntity> page=new Page<>(cwCostPagination.getCurrentPage(), cwCostPagination.getPageSize());
IPage<CwCostEntity> userIPage=this.page(page, cwCostQueryWrapper);
return cwCostPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<CwCostEntity> list = new ArrayList();
return cwCostPagination.setData(list, list.size());
}
}else{
return this.list(cwCostQueryWrapper);
}
}
@Override
public CwCostEntity getInfo(String id){
QueryWrapper<CwCostEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(CwCostEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(CwCostEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, CwCostEntity entity){
return this.updateById(entity);
}
@Override
public void delete(CwCostEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(CwCostForm 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.getCostPrice())){
return "费用金额不能为空";
}
if(StringUtil.isNotEmpty(form.getCostPrice())){
if(!Pattern.compile("^([1-9][\\d]*|0)(\\.[\\d]+)?$").matcher(String.valueOf(form.getCostPrice())).matches()){
return "请输入正确的金额";
}
}
return countRecover;
}
/**
* ()
* @param id
* @param cwCostForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(CwCostForm cwCostForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
cwCostForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(CwCostConstant.getFormData(),cwCostForm),CwCostForm.class);
CwCostEntity entity = JsonUtil.getJsonToBean(cwCostForm, CwCostEntity.class);
if(isSave){
String mainId = id ;
entity.setCode(generaterSwapUtil.getBillNumber("costCode", false));
entity.setId(mainId);
entity.setFlowId(cwCostForm.getFlowId());
entity.setVersion(0);
}else{
entity.setCode(generaterSwapUtil.getBillNumber("costCode", false));
entity.setFlowId(cwCostForm.getFlowId());
}
this.saveOrUpdate(entity);
}
}

@ -0,0 +1,424 @@
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.cwcost.*;
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;
/**
* cwCost
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-26
*/
@Slf4j
@RestController
@Tag(name = "cwCost" , description = "scm")
@RequestMapping("/api/scm/CwCost")
public class CwCostController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private CwCostService cwCostService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param cwCostPagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody CwCostPagination cwCostPagination)throws IOException{
List<CwCostEntity> list= cwCostService.getList(cwCostPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (CwCostEntity entity : list) {
Map<String, Object> cwCostMap=JsonUtil.entityToMap(entity);
cwCostMap.put("id", cwCostMap.get("id"));
//副表数据
//子表数据
realList.add(cwCostMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, CwCostConstant.getFormData(), CwCostConstant.getColumnData(), cwCostPagination.getModuleId(),false);
//流程状态添加
for(Map<String, Object> vo:realList){
FlowTaskEntity flowTaskEntity = generaterSwapUtil.getInfoSubmit(String.valueOf(vo.get("id")), FlowTaskEntity::getStatus);
if (flowTaskEntity!=null){
vo.put("flowState",flowTaskEntity.getStatus());
}else{
vo.put("flowState",null);
}
//添加流程id
String flowId="";
if(vo.get("flowid")!=null){
flowId = String.valueOf(vo.get("flowid"));
}
if(vo.get("flowid".toUpperCase())!=null){
flowId = String.valueOf(vo.get("flowid".toUpperCase()));
}
if(StringUtil.isNotEmpty(flowId)){
vo.put("flowId" ,flowId);
}
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(cwCostPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param cwCostForm
* @return
*/
@PostMapping("/{id}")
@Operation(summary = "创建")
public ActionResult create(@PathVariable("id") String id, @RequestBody @Valid CwCostForm cwCostForm) {
String b = cwCostService.checkForm(cwCostForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
cwCostService.saveOrUpdate(cwCostForm, id ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody CwCostPagination cwCostPagination) throws IOException {
if (StringUtil.isEmpty(cwCostPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<CwCostEntity> list= cwCostService.getList(cwCostPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (CwCostEntity entity : list) {
Map<String, Object> cwCostMap=JsonUtil.entityToMap(entity);
cwCostMap.put("id", cwCostMap.get("id"));
//副表数据
//子表数据
realList.add(cwCostMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, CwCostConstant.getFormData(), CwCostConstant.getColumnData(), cwCostPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(cwCostPagination.getSelectKey())?cwCostPagination.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 "code" :
entitys.add(new ExcelExportEntity("单据编号" ,"code"));
break;
case "institutionId" :
entitys.add(new ExcelExportEntity("费用归属" ,"institutionId"));
break;
case "subjectId" :
entitys.add(new ExcelExportEntity("往来单位" ,"subjectId"));
break;
case "costTime" :
entitys.add(new ExcelExportEntity("费用发生时间" ,"costTime"));
break;
case "businessCode" :
entitys.add(new ExcelExportEntity("关联数据" ,"businessCode"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "costProject" :
entitys.add(new ExcelExportEntity("费用项目" ,"costProject"));
break;
case "type" :
entitys.add(new ExcelExportEntity("收付类型" ,"type"));
break;
case "wayType" :
entitys.add(new ExcelExportEntity("付款方式" ,"wayType"));
break;
case "wayStatus" :
entitys.add(new ExcelExportEntity("付款状态" ,"wayStatus"));
break;
case "costPrice" :
entitys.add(new ExcelExportEntity("费用金额" ,"costPrice"));
break;
case "payment" :
entitys.add(new ExcelExportEntity("收付款单号" ,"payment"));
break;
case "pictures" :
entitys.add(new ExcelExportEntity("图片" ,"pictures"));
break;
case "annexFile" :
entitys.add(new ExcelExportEntity("附件文件" ,"annexFile"));
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(CwCostConstant.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);
List<String> columnIdList = new ArrayList<>(20);
int i =0;
String errInfo = "";
for (String allId : idList){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(allId, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity==null){
columnIdList.add(allId);
this.delete(allId);
}else if (taskEntity.getStatus().equals(0) || taskEntity.getStatus().equals(4)){
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
columnIdList.add(allId);
this.delete(allId);
i++;
} catch (WorkFlowException e) {
errInfo = e.getMessage();
e.printStackTrace();
}
}
}
if (i == 0 && columnIdList.size()==0){
return ActionResult.fail("流程已发起,无法删除");
}
if (StringUtil.isNotEmpty(errInfo)){
return ActionResult.fail(errInfo);
}
return ActionResult.success("删除成功");
}
/**
*
* @param id
* @param cwCostForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid CwCostForm cwCostForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
cwCostForm.setId(id);
if (!isImport) {
String b = cwCostService.checkForm(cwCostForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
CwCostEntity entity= cwCostService.getInfo(id);
if(entity!=null){
try{
cwCostService.saveOrUpdate(cwCostForm,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){
CwCostEntity entity= cwCostService.getInfo(id);
if(entity!=null){
FlowTaskEntity taskEntity = generaterSwapUtil.getInfoSubmit(id, FlowTaskEntity::getId, FlowTaskEntity::getStatus);
if (taskEntity != null) {
try {
generaterSwapUtil.deleteFlowTask(taskEntity);
} catch (WorkFlowException e) {
e.printStackTrace();
}
}
//假删除
entity.setDeleteMark(1);
cwCostService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
CwCostEntity entity= cwCostService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> cwCostMap=JsonUtil.entityToMap(entity);
cwCostMap.put("id", cwCostMap.get("id"));
//副表数据
//子表数据
cwCostMap = generaterSwapUtil.swapDataDetail(cwCostMap,CwCostConstant.getFormData(),"542307079671527429",false);
return ActionResult.success(cwCostMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
CwCostEntity entity= cwCostService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> cwCostMap=JsonUtil.entityToMap(entity);
cwCostMap.put("id", cwCostMap.get("id"));
//副表数据
//子表数据
cwCostMap = generaterSwapUtil.swapDataForm(cwCostMap,CwCostConstant.getFormData(),CwCostConstant.TABLEFIELDKEY,CwCostConstant.TABLERENAMES);
return ActionResult.success(cwCostMap);
}
}

@ -0,0 +1,75 @@
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-03-26
*/
@Data
@TableName("jg_cw_cost")
public class CwCostEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "INSTITUTION_ID" , updateStrategy = FieldStrategy.IGNORED)
private String institutionId;
@TableField(value = "CODE" , updateStrategy = FieldStrategy.IGNORED)
private String code;
@TableField(value = "SUBJECT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String subjectId;
@TableField(value = "COST_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date costTime;
@TableField(value = "BUSINESS_CODE" , updateStrategy = FieldStrategy.IGNORED)
private String businessCode;
@TableField(value = "REMARK" , updateStrategy = FieldStrategy.IGNORED)
private String remark;
@TableField(value = "COST_PROJECT" , updateStrategy = FieldStrategy.IGNORED)
private String costProject;
@TableField(value = "TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String type;
@TableField(value = "WAY_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String wayType;
@TableField(value = "WAY_STATUS" , updateStrategy = FieldStrategy.IGNORED)
private String wayStatus;
@TableField(value = "COST_PRICE" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal costPrice;
@TableField(value = "PAYMENT" , updateStrategy = FieldStrategy.IGNORED)
private String payment;
@TableField(value = "PICTURES" , updateStrategy = FieldStrategy.IGNORED)
private String pictures;
@TableField(value = "ANNEX_FILE" , updateStrategy = FieldStrategy.IGNORED)
private String annexFile;
@TableField(value = "f_creator_time" , fill = FieldFill.INSERT)
private Date creatorTime;
@TableField(value = "f_creator_user_id" , fill = FieldFill.INSERT)
private String creatorUserId;
@TableField(value = "f_last_modify_time" , fill = FieldFill.INSERT_UPDATE)
private Date lastModifyTime;
@TableField(value = "f_last_modify_user_id" , fill = FieldFill.INSERT_UPDATE)
private String lastModifyUserId;
@TableField(value = "f_delete_time" , fill = FieldFill.UPDATE)
private Date deleteTime;
@TableField(value = "f_delete_user_id" , fill = FieldFill.UPDATE)
private String deleteUserId;
@TableField(value = "f_delete_mark" , updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
@TableField(value = "company_id" , fill = FieldFill.INSERT)
private String companyId;
@TableField(value = "department_id" , fill = FieldFill.INSERT)
private String departmentId;
@TableField(value = "organize_json_id" , fill = FieldFill.INSERT)
private String organizeJsonId;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
}

@ -0,0 +1,68 @@
package jnpf.model.cwcost;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* cwCost
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-26
*/
@Data
public class CwCostForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 流程id **/
@JsonProperty("flowId")
private String flowId;
/** 单据编号 **/
@JsonProperty("code")
private String code;
/** 费用归属 **/
@JsonProperty("institutionId")
private Object institutionId;
/** 往来单位 **/
@JsonProperty("subjectId")
private String subjectId;
/** 费用发生时间 **/
@JsonProperty("costTime")
private String costTime;
/** 关联数据 **/
@JsonProperty("businessCode")
private String businessCode;
/** 备注 **/
@JsonProperty("remark")
private String remark;
/** 费用项目 **/
@JsonProperty("costProject")
private Object costProject;
/** 收付类型 **/
@JsonProperty("type")
private String type;
/** 付款方式 **/
@JsonProperty("wayType")
private String wayType;
/** 付款状态 **/
@JsonProperty("wayStatus")
private String wayStatus;
/** 费用金额 **/
@JsonProperty("costPrice")
private String costPrice;
/** 收付款单号 **/
@JsonProperty("payment")
private String payment;
/** 图片 **/
@JsonProperty("pictures")
private Object pictures;
/** 附件文件 **/
@JsonProperty("annexFile")
private Object annexFile;
}

@ -0,0 +1,45 @@
package jnpf.model.cwcost;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* cwCost
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-03-26
*/
@Data
public class CwCostPagination 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("code")
private Object code;
/** 费用归属 */
@JsonProperty("institutionId")
private Object institutionId;
/** 费用发生时间 */
@JsonProperty("costTime")
private Object costTime;
/** 费用项目 */
@JsonProperty("costProject")
private Object costProject;
/** 收付类型 */
@JsonProperty("type")
private Object type;
}

File diff suppressed because one or more lines are too long

@ -0,0 +1,568 @@
<template>
<div :style="{ margin: '0 auto', width: '100%' }">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px"
label-position="right" :disabled="setting.readonly">
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="24">
<div style="padding:15px 0px">
<span style="color: #409EFF;"></span>
<span style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">基础信息</span>
</div>
</el-col>
<el-col :span="8" v-if="judgeShow('code')">
<jnpf-form-tip-item label="单据编号" v-if="judgeShow('code')" prop="code">
<JnpfInput v-model="dataForm.code" @change="changeData('code', -1)" placeholder="系统自动生成"
:disabled="judgeWrite('code')" readonly :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('institutionId')">
<jnpf-form-tip-item label="费用归属" v-if="judgeShow('institutionId')" prop="institutionId">
<JnpfOrganizeSelect v-model="dataForm.institutionId" disabled
@change="changeData('institutionId', -1)" placeholder="请选择" selectType="all"
:ableIds="ableAll.institutionIdableIds" clearable :style='{ "width": "100%" }'>
</JnpfOrganizeSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('subjectId')">
<jnpf-form-tip-item label="往来单位" v-if="judgeShow('subjectId')" prop="subjectId">
<JnpfPopupSelect v-model="dataForm.subjectId" @change="changeData('subjectId', -1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.subjectId"
placeholder="请选择" :disabled="judgeWrite('subjectId')" hasPage propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
field='subjectId' interfaceId="542305697765799941" :pageSize="20"
:columnOptions="subjectIdcolumnOptions" clearable :style='{ "width": "100%" }'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('costTime')">
<jnpf-form-tip-item label="费用发生时间" v-if="judgeShow('costTime')" prop="costTime">
<JnpfDatePicker v-model="dataForm.costTime" @change="changeData('costTime', -1)"
:startTime="dateTime(false, 1, 1, '', '')" :endTime="dateTime(false, 1, 1, '', '')"
placeholder="请选择" :disabled="judgeWrite('costTime')" clearable
:style='{ "width": "100%" }' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessCode')">
<jnpf-form-tip-item label="关联数据" v-if="judgeShow('businessCode')" prop="businessCode">
<JnpfInput v-model="dataForm.businessCode" @change="changeData('businessCode', -1)"
placeholder="请输入" :disabled="judgeWrite('businessCode')" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('remark')">
<jnpf-form-tip-item label="备注" v-if="judgeShow('remark')" prop="remark">
<JnpfTextarea v-model="dataForm.remark" @change="changeData('remark', -1)" placeholder="请输入"
:disabled="judgeWrite('remark')" :maxlength="300" :style='{ "width": "100%" }' true
type="textarea" :autosize='{ "minRows": 4, "maxRows": 4 }'>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<div style="padding:15px 0px">
<span style="color: #409EFF;"></span>
<span style="font-size: 14px;font-weight: 500;color:rgb(102, 102, 102);">费用信息</span>
</div>
</el-col>
<el-col :span="8" v-if="judgeShow('costProject')">
<jnpf-form-tip-item label="费用项目" v-if="judgeShow('costProject')" prop="costProject">
<JnpfCascader v-model="dataForm.costProject" @change="changeData('costProject', -1)"
placeholder="请选择" show-all-levels :disabled="judgeWrite('costProject')" clearable
:style='{ "width": "100%" }' separator="/" :options="costProjectOptions"
:props="costProjectProps">
</JnpfCascader>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('type')">
<jnpf-form-tip-item label="收付类型" v-if="judgeShow('type')" prop="type">
<JnpfRadio v-model="dataForm.type" @change="changeData('type', -1)"
:disabled="judgeWrite('type')" optionType="default" direction="horizontal" size="small"
:options="typeOptions" :props="typeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="dataForm.type == 0">
</el-col>
<el-col :span="8" v-if="dataForm.type == 1">
<jnpf-form-tip-item label="付款方式" v-if="judgeShow('wayType')" prop="wayType">
<JnpfRadio v-model="dataForm.wayType" @change="changeData('wayType', -1)"
:disabled="judgeWrite('wayType')" optionType="default" direction="horizontal"
size="small" :options="wayTypeOptions" :props="wayTypeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="dataForm.type == 2">
<jnpf-form-tip-item label="付款方式" v-if="judgeShow('wayType')" prop="wayType">
<JnpfRadio v-model="dataForm.wayType" @change="changeData('wayType', -1)"
:disabled="judgeWrite('wayType')" optionType="default" direction="horizontal"
size="small" :options="wayTypeOptionss" :props="wayTypeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="dataForm.type == 1">
<jnpf-form-tip-item label="付款状态" v-if="judgeShow('wayStatus')" prop="wayStatus">
<JnpfRadio v-model="dataForm.wayStatus" @change="changeData('wayStatus', -1)"
:disabled="judgeWrite('wayStatus')" optionType="default" direction="horizontal"
size="small" :options="wayStatusOptions" :props="wayStatusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="dataForm.type == 2">
<jnpf-form-tip-item label="付款状态" v-if="judgeShow('wayStatus')" prop="wayStatus">
<JnpfRadio v-model="dataForm.wayStatus" @change="changeData('wayStatus', -1)"
:disabled="judgeWrite('wayStatus')" optionType="default" direction="horizontal"
size="small" :options="wayStatusOptionss" :props="wayStatusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('costPrice')">
<jnpf-form-tip-item label="费用金额" v-if="judgeShow('costPrice')" prop="costPrice">
<JnpfInput v-model="dataForm.costPrice" @change="changeData('costPrice', -1)"
placeholder="请输入" :disabled="judgeWrite('costPrice')" clearable
:style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('payment')">
<jnpf-form-tip-item label="收付款单号" v-if="judgeShow('payment')" prop="payment">
<JnpfInput v-model="dataForm.payment" @change="changeData('payment', -1)" placeholder="请输入"
:disabled="judgeWrite('payment')" clearable :style='{ "width": "100%" }'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('pictures')">
<jnpf-form-tip-item label="图片" v-if="judgeShow('pictures')" prop="pictures">
<JnpfUploadImg v-model="dataForm.pictures" @change="changeData('pictures', -1)"
:disabled="judgeWrite('pictures')" :fileSize="10" sizeUnit="MB" :limit="1"
pathType="defaultPath" :isAccount="0">
</JnpfUploadImg>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('annexFile')">
<jnpf-form-tip-item label="附件文件" v-if="judgeShow('annexFile')" prop="annexFile">
<JnpfUploadFile v-model="dataForm.annexFile" @change="changeData('annexFile', -1)"
:disabled="judgeWrite('annexFile')" :fileSize="10" sizeUnit="MB" :limit="1"
pathType="defaultPath" :isAccount="0" buttonText="点击上传">
</JnpfUploadFile>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible = false" />
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getFormById } from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
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 {
mixins: [comMixin],
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: {
code: undefined,
institutionId: [],
subjectId: undefined,
costTime: undefined,
businessCode: undefined,
remark: undefined,
costProject: [],
type: undefined,
wayType: undefined,
wayStatus: undefined,
costPrice: undefined,
payment: undefined,
pictures: [],
annexFile: [],
version: 0,
},
tableRequiredData: {},
dataRule:
{
institutionId: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
subjectId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
costTime: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
remark: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
],
costProject: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
type: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
wayType: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
wayStatus: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
costPrice: [
{
required: true,
message: '请输入',
trigger: 'blur'
},
{
pattern: /^([1-9][\d]*|0)(\.[\d]+)?$/,
message: '请输入正确的金额',
trigger: 'blur'
},
],
pictures: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
annexFile: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
subjectIdcolumnOptions: [{ "label": "类型", "value": "subjectBasicTypes" }, { "label": "名称", "value": "name" },],
costProjectOptions: [{ "children": [{ "fullName": "交易服务费", "id": "E1001" }, { "fullName": "保险费", "id": "E1002" }, { "fullName": "包装费", "id": "E1003" }, { "fullName": "运费", "id": "E1004" }, { "fullName": "装卸费", "id": "E1005" }, { "fullName": "服务费", "id": "E1011" }, { "fullName": "管理服务费", "id": "E1012" }, { "fullName": "管理服务费退回", "id": "E1013" }, { "fullName": "海关税费", "id": "E1014" }, { "fullName": "技术服务费", "id": "E1015" }, { "fullName": "技术服务费退回", "id": "E1016" }, { "fullName": "交易手续费", "id": "E1017" }, { "fullName": "交易手续费-常规交易", "id": "E1018" }, { "fullName": "交易手续费退回", "id": "E1019" }, { "fullName": "金融服务费-预付回款", "id": "E1020" }, { "fullName": "金融服务费退回-垫资回款", "id": "E1021" }, { "fullName": "金融服务费-垫资回款", "id": "E1022" }, { "fullName": "运费", "id": "E1023" }, { "fullName": "运费退回", "id": "E1024" }, { "fullName": "平台服务费-账户管理费", "id": "E1025" }, { "fullName": "平台服务费-平台分销", "id": "E1026" }, { "fullName": "手续费", "id": "E1029" }, { "fullName": "手续费补贴", "id": "E1030" }, { "fullName": "保障服务费退回-退货运费", "id": "E1031" }, { "fullName": "保障服务费-退货运费", "id": "E1032" }, { "fullName": "保障服务费-担保费", "id": "E1033" }], "fullName": "销售服务", "id": "E1000" }, { "children": [{ "fullName": "采购保证金", "id": "E2000" }, { "fullName": "质量保证金", "id": "E2001" }, { "fullName": "销售保证金", "id": "E2002" }, { "fullName": "合作保证金", "id": "E2003" }], "fullName": "保证金", "id": "E200" }, { "children": [{ "fullName": "广告费", "id": "E3001" }, { "fullName": "促销费用", "id": "E3002" }, { "fullName": "节庆费", "id": "E3003" }, { "fullName": "订单返现费用", "id": "E3009" }], "fullName": "营销活动", "id": "E3000" }, { "children": [{ "fullName": "赔付", "id": "E4001" }, { "fullName": "水费", "id": "E4002" }, { "fullName": "电费", "id": "E4003" }, { "fullName": "气费", "id": "E4004" }, { "fullName": "物业管理费", "id": "E4005" }, { "fullName": "物料消耗", "id": "E4006" }, { "fullName": "信息使用费", "id": "E4007" }, { "fullName": "展览费", "id": "E4008" }, { "fullName": "租赁费", "id": "E4009" }, { "fullName": "修理费", "id": "E4010" }], "fullName": "销售场地", "id": "E4000" }, { "children": [{ "fullName": "折旧费", "id": "E5001" }, { "fullName": "人员工资", "id": "E5002" }, { "fullName": "职工福利费", "id": "E5003" }, { "fullName": "差旅费", "id": "E5004" }], "fullName": "销售人员", "id": "E5000" }, { "children": [{ "fullName": "办公费", "id": "E6001" }, { "fullName": "委托代销手续费", "id": "E6002" }, { "fullName": "销售提成", "id": "E6003" }, { "fullName": "采购奖励", "id": "E6004" }, { "fullName": "佣金退回撤销-分销", "id": "E6006" }, { "fullName": "佣金退回-销售员", "id": "E6007" }, { "fullName": "佣金退回-分销", "id": "E6008" }, { "fullName": "佣金-销售员", "id": "E6009" }, { "fullName": "佣金-分销", "id": "E6011" }, { "fullName": "奖励", "id": "E6012" }], "fullName": "委托销售", "id": "E6000" }],
costProjectProps: { "label": "fullName", "value": "id", "children": "children" },
typeOptions: [{ "fullName": "收款", "id": "1" }, { "fullName": "付款", "id": "2" }],
typeProps: { "label": "fullName", "value": "id" },
wayTypeOptions: [{ "fullName": "单独收款", "id": "1" }, { "fullName": "账扣", "id": "2" }],
wayTypeOptionss: [{ "fullName": "单据付款", "id": "3" }, { "fullName": "账扣", "id": "4" }],
wayTypeProps: { "label": "fullName", "value": "id" },
wayStatusOptions: [{ "fullName": "未收款", "id": "1" }, { "fullName": "已收款", "id": "2" }],
wayStatusOptionss: [{ "fullName": "未付款", "id": "3" }, { "fullName": "已付款", "id": "4" }],
wayStatusProps: { "label": "fullName", "value": "id" },
childIndex: -1,
isEdit: false,
interfaceRes: {
code: [],
institutionId: [],
subjectId: [],
costTime: [],
businessCode: [],
remark: [],
costProject: [],
type: [],
wayType: [],
wayStatus: [],
costPrice: [],
payment: [],
pictures: [],
annexFile: [],
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if (this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() { },
methods: {
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() {
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit() {
const _data = this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("542307079671527429").then(res => {
this.dataForm.flowId = res.data && res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
return isOk
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
if (this.userInfo.organizeIdList instanceof Array && this.userInfo.organizeIdList.length > 0) {
this.dataForm.institutionId = this.userInfo.organizeIdList
}
// if (
// this.userInfo.organizeIdList instanceof Array &&
// this.userInfo.organizeIdList.length > 0
// ) {
// this.dataForm.institutionId = this.userInfo.organizeIdList;
// }
// this.dataForm.firstContactPerson = this.userInfo.userId;
// if (
// this.$store.getters.userInfo.organizeId &&
// this.$store.getters.userInfo.organizeId != null
// ) {
// this.dataForm.institutionId = this.$store.getters.userInfo.organizeId;
// }
this.dataForm.costTime = new Date().getTime()
},
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,629 @@
<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.code" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="费用归属">
<JnpfOrganizeSelect selectType="all" v-model="query.institutionId" placeholder="
" clearable multiple />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="费用发生时间">
<JnpfDateRangePicker v-model="query.costTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<el-form-item label="费用项目">
<JnpfCascader v-model="query.costProject" placeholder="请选择"
:options="costProjectOptions" :props="costProjectProps" clearable />
</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>
<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 custom-column border
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="code" label="单据编号" align="center" fixed="left" sortable width="250px">
</el-table-column>
<el-table-column prop="institutionId" label="费用归属" align="center" fixed="left" sortable
width="250px">
</el-table-column>
<el-table-column prop="subjectId" label="往来单位" align="center" fixed="left" width="200px">
</el-table-column>
<el-table-column prop="costTime" label="费用发生时间" align="center" sortable width="200px">
</el-table-column>
<el-table-column label="费用项目" prop="costProject" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.costProject }}
</template>
</el-table-column>
<el-table-column prop="1" label="关联结算单" align="center" width="200px">
</el-table-column>
<el-table-column prop="2" label="关联收付款单" align="center" width="200px">
</el-table-column>
<el-table-column label="收付类型" prop="type" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.type }}
</template>
</el-table-column>
<el-table-column label="付款方式" prop="wayType" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.wayType }}
</template>
</el-table-column>
<el-table-column label="付款状态" prop="wayStatus" align="center" width="200px">
<template slot-scope="scope">
{{ scope.row.wayStatus }}
</template>
</el-table-column>
<!-- <el-table-column prop="costPrice" label="费用金额" align="center">
</el-table-column> -->
<el-table-column prop="flowState" label="状态" width="150px" align="center">
<template slot-scope="scope" v-if="!scope.row.top">
<el-tag v-if="scope.row.flowState == 1"></el-tag>
<el-tag type="success" v-else-if="scope.row.flowState == 2">审核通过</el-tag>
<el-tag type="danger" v-else-if="scope.row.flowState == 3">审核驳回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState == 4">流程撤回</el-tag>
<el-tag type="info" v-else-if="scope.row.flowState == 5">审核终止</el-tag>
<el-tag type="warning" v-else></el-tag>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="150" align="center">
<template slot-scope="scope">
<el-button type="text" :disabled="[1, 2, 4, 5].indexOf(scope.row.flowState) > -1"
@click="updateHandle(scope.row)" v-has="'btn_edit'">编辑
</el-button>
<el-button type="text" class="JNPF-table-delBtn"
:disabled="[1, 2, 3, 5].indexOf(scope.row.flowState) > -1" v-has="'btn_remove'"
@click="handleDel(scope.row.id)">删除
</el-button>
<el-button size="mini" type="text" :disabled="!scope.row.flowState"
@click="updateHandle(scope.row, scope.row.flowState)">详情</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" />
<FlowBox v-if="flowVisible" ref="FlowBox" @close="colseFlow" />
<el-dialog title="请选择流程" :close-on-click-modal="false" append-to-body :visible.sync="flowListVisible"
class="JNPF-dialog template-dialog JNPF-dialog_center" lock-scroll width="400px">
<el-scrollbar class="template-list">
<div class="template-item" v-for="item in flowList" :key="item.id" @click="selectFlow(item)">
{{ item.fullName }}
</div>
</el-scrollbar>
</el-dialog>
<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 { getFormById } from '@/api/workFlow/FormDesign'
import { getFlowList } from '@/api/workFlow/FlowEngine'
import FlowBox from '@/views/workFlow/components/FlowBox'
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: {
FlowBox,
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: {
code: undefined,
institutionId: undefined,
costTime: undefined,
costProject: undefined,
type: 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,
costProjectOptions: [{ "children": [{ "fullName": "交易服务费", "id": "E1001" }, { "fullName": "保险费", "id": "E1002" }, { "fullName": "包装费", "id": "E1003" }, { "fullName": "运费", "id": "E1004" }, { "fullName": "装卸费", "id": "E1005" }, { "fullName": "服务费", "id": "E1011" }, { "fullName": "管理服务费", "id": "E1012" }, { "fullName": "管理服务费退回", "id": "E1013" }, { "fullName": "海关税费", "id": "E1014" }, { "fullName": "技术服务费", "id": "E1015" }, { "fullName": "技术服务费退回", "id": "E1016" }, { "fullName": "交易手续费", "id": "E1017" }, { "fullName": "交易手续费-常规交易", "id": "E1018" }, { "fullName": "交易手续费退回", "id": "E1019" }, { "fullName": "金融服务费-预付回款", "id": "E1020" }, { "fullName": "金融服务费退回-垫资回款", "id": "E1021" }, { "fullName": "金融服务费-垫资回款", "id": "E1022" }, { "fullName": "运费", "id": "E1023" }, { "fullName": "运费退回", "id": "E1024" }, { "fullName": "平台服务费-账户管理费", "id": "E1025" }, { "fullName": "平台服务费-平台分销", "id": "E1026" }, { "fullName": "手续费", "id": "E1029" }, { "fullName": "手续费补贴", "id": "E1030" }, { "fullName": "保障服务费退回-退货运费", "id": "E1031" }, { "fullName": "保障服务费-退货运费", "id": "E1032" }, { "fullName": "保障服务费-担保费", "id": "E1033" }], "fullName": "销售服务", "id": "E1000" }, { "children": [{ "fullName": "采购保证金", "id": "E2000" }, { "fullName": "质量保证金", "id": "E2001" }, { "fullName": "销售保证金", "id": "E2002" }, { "fullName": "合作保证金", "id": "E2003" }], "fullName": "保证金", "id": "E200" }, { "children": [{ "fullName": "广告费", "id": "E3001" }, { "fullName": "促销费用", "id": "E3002" }, { "fullName": "节庆费", "id": "E3003" }, { "fullName": "订单返现费用", "id": "E3009" }], "fullName": "营销活动", "id": "E3000" }, { "children": [{ "fullName": "赔付", "id": "E4001" }, { "fullName": "水费", "id": "E4002" }, { "fullName": "电费", "id": "E4003" }, { "fullName": "气费", "id": "E4004" }, { "fullName": "物业管理费", "id": "E4005" }, { "fullName": "物料消耗", "id": "E4006" }, { "fullName": "信息使用费", "id": "E4007" }, { "fullName": "展览费", "id": "E4008" }, { "fullName": "租赁费", "id": "E4009" }, { "fullName": "修理费", "id": "E4010" }], "fullName": "销售场地", "id": "E4000" }, { "children": [{ "fullName": "折旧费", "id": "E5001" }, { "fullName": "人员工资", "id": "E5002" }, { "fullName": "职工福利费", "id": "E5003" }, { "fullName": "差旅费", "id": "E5004" }], "fullName": "销售人员", "id": "E5000" }, { "children": [{ "fullName": "办公费", "id": "E6001" }, { "fullName": "委托代销手续费", "id": "E6002" }, { "fullName": "销售提成", "id": "E6003" }, { "fullName": "采购奖励", "id": "E6004" }, { "fullName": "佣金退回撤销-分销", "id": "E6006" }, { "fullName": "佣金退回-销售员", "id": "E6007" }, { "fullName": "佣金退回-分销", "id": "E6008" }, { "fullName": "佣金-销售员", "id": "E6009" }, { "fullName": "佣金-分销", "id": "E6011" }, { "fullName": "奖励", "id": "E6012" }], "fullName": "委托销售", "id": "E6000" }],
costProjectProps: { "label": "fullName", "value": "id", "children": "children" },
typeOptions: [{ "fullName": "收款", "id": "1" }, { "fullName": "付款", "id": "2" }],
typeProps: { "label": "fullName", "value": "id" },
wayTypeOptions: [{ "fullName": "单独收款", "id": "1" }, { "fullName": "账扣", "id": "2" }, { "fullName": "单据付款", "id": "3" }, { "fullName": "账扣", "id": "4" }],
wayTypeProps: { "label": "fullName", "value": "id" },
wayStatusOptions: [{ "fullName": "未收款", "id": "1" }, { "fullName": "已收款", "id": "2" }, { "fullName": "未付款", "id": "3" }, { "fullName": "已付款", "id": "4" }],
wayStatusProps: { "label": "fullName", "value": "id" },
interfaceRes: {
subjectId: [],
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
getFormById("542307079671527429").then(res1 => {
let flowId = res1.data && res1.data.id
getFlowList(flowId, '1').then(res2 => {
this.flowList = res2.data
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
}).catch((e) => {
this.$message({ type: 'error', message: e.message });
this.$router.push('/404');
})
})
},
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: '542307079671527429',
type: 1,
};
request({
url: `/api/scm/CwCost/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/CwCost/${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/CwCost")
})
},
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/CwCost/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, flowState) {
if (!row) {
this.addHandle();
} else {
this.updateHandle(row, flowState)
}
},
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/CwCost/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()
},
//
updateHandle(row, flowState) {
let data = {
id: row.id,
flowId: row.flowId || this.flowList[0].id,
opType: flowState ? 0 : '-1',
status: flowState
}
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
toApprovalDetail(row) {
let data = {
id: row.id,
flowId: row.flowId,
opType: 0,
status: row.currentState
}
this.formVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
addHandle() {
if (!this.flowList.length) {
this.$message({ type: 'error', message: '流程不存在' });
} else if (this.flowList.length === 1) {
this.selectFlow(this.flowList[0])
} else {
this.flowListVisible = true
}
},
//
selectFlow(item) {
let data = {
id: '',
formType: 1,
flowId: item.id,
opType: '-1'
}
this.flowListVisible = false
this.flowVisible = true
this.$nextTick(() => {
this.$refs.FlowBox.init(data)
})
},
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