定义接口

jg-waiwang-pro
胡川虎 8 months ago
parent 639d2439e3
commit 7ac7a68b1b

@ -0,0 +1,99 @@
<?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.ProductPriceMapper">
<select id="queryByKeyword" resultType="jnpf.entity.ProductPriceEntity">
SELECT a.* from jg_product_price a where a.status = '1'
<!-- SELECT a.*,b.ticketno vehicleName,c.supplier_name supplierName,d.supplier_nm customerName,e.item_name materialName,f.contract_name salesName,g.contract_name purchaseName,h.F_RealName businessName,-->
<!-- i.name naturalName,g.contract_no purchaseContractNo,f.contract_no salesContractNo, j.id purchaseorderItem0Id,k.id salesorderItem0Id,k.rate saleRate,jp.is_payment isPayment-->
<!-- from jg_poundlist a-->
<!-- LEFT JOIN jg_vehicle b on a.vehicle_id = b.id and b.delete_mark = 0-->
<!-- LEFT JOIN jg_supplier c on a.supplier_id = c.id and c.delete_mark = 0-->
<!-- LEFT JOIN jg_customer d on a.customer_id = d.id and d.delete_mark = 0-->
<!-- LEFT JOIN jg_material e on a.material_id = e.id and e.delete_mark = 0-->
<!-- LEFT JOIN jg_contract f on a.sales_id = f.id and f.delete_mark = 0-->
<!-- LEFT JOIN jg_contract g on a.purchase_id = g.id and g.delete_mark = 0-->
<!-- LEFT JOIN base_user h on a.business_id = h.f_id-->
<!-- LEFT JOIN jg_natural i on a.natural_id = i.id and i.delete_mark = 0-->
<!-- LEFT JOIN jg_purchaseorder_item0 j on a.id = j.poundlist_id and j.delete_mark = 0-->
<!-- LEFT JOIN jg_salesorder_item0 k on a.id = k.poundlist_id and k.delete_mark = 0-->
<!-- LEFT JOIN jg_purchaseorder jp ON a.purchaseorder_id=jp.id and jp.delete_mark = 0-->
<!-- LEFT JOIN jg_salesorder js ON a.salesorder_id=js.id and js.delete_mark = 0-->
<!-- ${ew.customSqlSegment} and a.delete_mark = 0-->
<!-- <if test="poundlistPagination.keyword != null and poundlistPagination.keyword != ''">-->
<!-- AND (b.ticketno LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR c.supplier_name LIKE CONCAT('%',#{poundlistPagination.keyword},'%') OR d.supplier_nm LIKE CONCAT('%',#{poundlistPagination.keyword},'%'))-->
<!-- </if>-->
<!-- <if test="poundlistPagination.startDate != null and poundlistPagination.endDate != null">-->
<!-- AND a.pound_date &gt; #{poundlistPagination.startDate} AND a.pound_date &lt;= #{poundlistPagination.endDate}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.poundlistNo != null and poundlistPagination.poundlistNo != ''">-->
<!-- AND a.poundlist_no LIKE CONCAT('%',#{poundlistPagination.poundlistNo},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.businessId != null and poundlistPagination.businessId != ''">-->
<!-- AND h.F_RealName LIKE CONCAT('%',#{poundlistPagination.businessId},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.isInvoicing != null and poundlistPagination.isInvoicing != ''">-->
<!-- AND a.is_Invoicing = #{poundlistPagination.isInvoicing}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.isPay != null and poundlistPagination.isPay != ''">-->
<!-- AND a.is_pay = #{poundlistPagination.isPay}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.isCollection != null and poundlistPagination.isCollection != ''">-->
<!-- AND a.is_collection = #{poundlistPagination.isCollection}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.isExpense != null and poundlistPagination.isExpense != ''">-->
<!-- AND a.is_expense = #{poundlistPagination.isExpense}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.purchaseStatus != null and poundlistPagination.purchaseStatus != ''">-->
<!-- AND a.purchase_status = #{poundlistPagination.purchaseStatus}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.salesStatus != null and poundlistPagination.salesStatus != ''">-->
<!-- AND a.sales_status = #{poundlistPagination.salesStatus}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.materialName != null and poundlistPagination.materialName != ''">-->
<!-- AND e.item_name LIKE CONCAT('%',#{poundlistPagination.materialName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.vehicleName != null and poundlistPagination.vehicleName != ''">-->
<!-- AND b.ticketno LIKE CONCAT('%',#{poundlistPagination.vehicleName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.purchaseName != null and poundlistPagination.purchaseName != ''">-->
<!-- AND g.contract_name LIKE CONCAT('%',#{poundlistPagination.purchaseName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.salesName != null and poundlistPagination.salesName != ''">-->
<!-- AND f.contract_name LIKE CONCAT('%',#{poundlistPagination.salesName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.customerName != null and poundlistPagination.customerName != ''">-->
<!-- AND d.supplier_nm LIKE CONCAT('%',#{poundlistPagination.customerName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.supplierName != null and poundlistPagination.supplierName != ''">-->
<!-- AND c.supplier_name LIKE CONCAT('%',#{poundlistPagination.supplierName},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.purchaseOrderId != null and poundlistPagination.purchaseOrderId != ''">-->
<!-- AND a.id IN (SELECT poundlist_id from jg_purchaseorder_item0 where purchaseorder_id = #{poundlistPagination.purchaseOrderId})-->
<!-- </if>-->
<!-- <if test="poundlistPagination.salesOrderId != null and poundlistPagination.salesOrderId != ''">-->
<!-- AND a.id IN (SELECT poundlist_id from jg_salesorder_item0 where sales_order_id = #{poundlistPagination.salesOrderId})-->
<!-- </if>-->
<!-- <if test="poundlistPagination.poundlistIds != null and poundlistPagination.poundlistIds.size()!=0">-->
<!-- AND a.id NOT IN-->
<!-- <foreach collection="poundlistPagination.poundlistIds" index="index" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="poundlistPagination.settlement != null and poundlistPagination.settlement != ''">-->
<!-- AND a.settlement = #{poundlistPagination.settlement}-->
<!-- </if>-->
<!-- <if test="poundlistPagination.purchaseorderNo != null and poundlistPagination.purchaseorderNo != ''">-->
<!-- AND jp.document_no LIKE CONCAT('%',#{poundlistPagination.purchaseorderNo},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.salesorderNo != null and poundlistPagination.salesorderNo != ''">-->
<!-- AND js.document_no LIKE CONCAT('%',#{poundlistPagination.salesorderNo},'%')-->
<!-- </if>-->
<!-- <if test="poundlistPagination.sidx != null and poundlistPagination.sidx != ''">-->
<!-- ORDER BY ${poundlistPagination.sidx} ${poundlistPagination.sort}-->
<!-- </if>-->
</select>
</mapper>

@ -27,6 +27,12 @@
<artifactId>jnpf-system-biz</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jnpf</groupId>
<artifactId>jnpf-scm-biz</artifactId>
<version>3.5.0-RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,56 @@
package jnpf.scheduletask.task;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import jnpf.base.UserInfo;
import jnpf.base.entity.DataInterfaceEntity;
import jnpf.base.service.DataInterfaceService;
import jnpf.base.service.DbLinkService;
import jnpf.entity.ProductPriceEntity;
import jnpf.scheduletask.entity.TimeTaskEntity;
import jnpf.scheduletask.model.ContentNewModel;
import jnpf.scheduletask.model.TaskParameterModel;
import jnpf.service.ProductPriceService;
import jnpf.util.JsonUtil;
import jnpf.util.StringUtil;
import jnpf.util.data.DataSourceContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Api使
*
* @author JNPF
* @version: V3.1.0
* @copyright
* @date 2022/3/23 9:25
*/
@Component
public class MyJobHandler {
@Autowired
private ProductPriceService productPriceService;
@XxlJob("myJobHandler1")
public void defaultHandler() {
// 获取参数
String param = XxlJobHelper.getJobParam();
Date date = new Date();
//查询商品价格表状态为正常的全部数据
QueryWrapper<ProductPriceEntity> productPriceQueryWrapper=new QueryWrapper<>();
productPriceQueryWrapper.lambda().eq(ProductPriceEntity::getStatus,"1");
List<ProductPriceEntity> list = productPriceService.list(productPriceQueryWrapper);
for (ProductPriceEntity productPriceEntity : list) {
if(productPriceEntity.getEndTime().getTime() <= date.getTime()){
productPriceEntity.setStatus("2");
productPriceService.updateById(productPriceEntity);
}
}
}
}

@ -0,0 +1,22 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jnpf.entity.ProductPriceEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.model.productprice.ProductPricePagination;
import org.apache.ibatis.annotations.Param;
/**
* ProductPrice
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-21
*/
public interface ProductPriceMapper extends BaseMapper<ProductPriceEntity> {
IPage<ProductPriceEntity> queryByKeyword(@Param("page") Page<ProductPriceEntity> page, @Param("productPricePagination") ProductPricePagination productPricePagination, @Param("ew") QueryWrapper<ProductPriceEntity> productPriceQueryWrapper);
}

@ -0,0 +1,36 @@
package jnpf.service;
import jnpf.model.productprice.*;
import jnpf.entity.*;
import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
/**
* ProductPrice
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-21
*/
public interface ProductPriceService extends IService<ProductPriceEntity> {
List<ProductPriceEntity> getList(ProductPricePagination productPricePagination);
List<ProductPriceEntity> getTypeList(ProductPricePagination productPricePagination,String dataType);
ProductPriceEntity getInfo(String id);
void delete(ProductPriceEntity entity);
void create(ProductPriceEntity entity);
boolean update(String id, ProductPriceEntity entity);
//子表方法
//副表数据方法
String checkForm(ProductPriceForm form,int i);
void saveOrUpdate(ProductPriceForm productPriceForm,String id, boolean isSave) throws Exception;
List<ProductPriceEntity> getProductpriceIndexList(ProductPricePagination productPricePagination);
}

@ -0,0 +1,486 @@
package jnpf.service.impl;
import jnpf.entity.*;
import jnpf.mapper.ProductPriceMapper;
import jnpf.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.model.productprice.*;
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;
/**
*
* ProductPrice
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-21
*/
@Service
public class ProductPriceServiceImpl extends ServiceImpl<ProductPriceMapper, ProductPriceEntity> implements ProductPriceService{
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ProductPriceMapper productPriceMapper;
@Override
public List<ProductPriceEntity> getList(ProductPricePagination productPricePagination){
return getTypeList(productPricePagination,productPricePagination.getDataType());
}
/** 列表查询 */
@Override
public List<ProductPriceEntity> getTypeList(ProductPricePagination productPricePagination,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 ? ProductPriceConstant.getAppColumnData() : ProductPriceConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int productPriceNum =0;
QueryWrapper<ProductPriceEntity> productPriceQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(productPricePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = productPricePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ProductPriceEntity> productPriceSuperWrapper = new QueryWrapper<>();
productPriceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productPriceSuperWrapper,ProductPriceEntity.class,queryJson,"0"));
int productPriceNum1 = productPriceSuperWrapper.getExpression().getNormal().size();
if (productPriceNum1>0){
List<String> productPriceList =this.list(productPriceSuperWrapper).stream().map(ProductPriceEntity::getId).collect(Collectors.toList());
allSuperList.addAll(productPriceList);
intersectionSuperList.add(productPriceList);
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<ProductPriceEntity> productPriceSuperWrapper = new QueryWrapper<>();
productPriceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productPriceSuperWrapper,ProductPriceEntity.class,ruleJson,"0"));
int productPriceNum1 = productPriceSuperWrapper.getExpression().getNormal().size();
if (productPriceNum1>0){
List<String> productPriceList =this.list(productPriceSuperWrapper).stream().map(ProductPriceEntity::getId).collect(Collectors.toList());
allRuleList.addAll(productPriceList);
intersectionRuleList.add(productPriceList);
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 productPriceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productPriceQueryWrapper,ProductPriceEntity.class,productPricePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productPriceObj)){
return new ArrayList<>();
} else {
productPriceQueryWrapper = (QueryWrapper<ProductPriceEntity>)productPriceObj;
if( productPriceQueryWrapper.getExpression().getNormal().size()>0){
productPriceNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object productPriceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productPriceQueryWrapper,ProductPriceEntity.class,productPricePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productPriceObj)){
return new ArrayList<>();
} else {
productPriceQueryWrapper = (QueryWrapper<ProductPriceEntity>)productPriceObj;
if( productPriceQueryWrapper.getExpression().getNormal().size()>0){
productPriceNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(productPricePagination.getPriceType())){
productPriceNum++;
productPriceQueryWrapper.lambda().eq(ProductPriceEntity::getPriceType,productPricePagination.getPriceType());
}
if(ObjectUtil.isNotEmpty(productPricePagination.getStartTime())){
productPriceNum++;
List StartTimeList = JsonUtil.getJsonToList(productPricePagination.getStartTime(),String.class);
Long fir = Long.valueOf(String.valueOf(StartTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(StartTimeList.get(1)));
productPriceQueryWrapper.lambda().ge(ProductPriceEntity::getStartTime, new Date(fir))
.le(ProductPriceEntity::getStartTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(productPricePagination.getEndTime())){
productPriceNum++;
List EndTimeList = JsonUtil.getJsonToList(productPricePagination.getEndTime(),String.class);
Long fir = Long.valueOf(String.valueOf(EndTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(EndTimeList.get(1)));
productPriceQueryWrapper.lambda().ge(ProductPriceEntity::getEndTime, new Date(fir))
.le(ProductPriceEntity::getEndTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
productPriceQueryWrapper.lambda().in(ProductPriceEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
productPriceQueryWrapper.lambda().and(t->t.in(ProductPriceEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
productPriceQueryWrapper.lambda().and(t->t.in(ProductPriceEntity::getId, finalAllRuleIDlist));
}
//假删除标志
productPriceQueryWrapper.lambda().isNull(ProductPriceEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(productPricePagination.getSidx())){
productPriceQueryWrapper.lambda().orderByDesc(ProductPriceEntity::getId);
}else{
try {
String sidx = productPricePagination.getSidx();
String[] strs= sidx.split("_name");
ProductPriceEntity productPriceEntity = new ProductPriceEntity();
Field declaredField = productPriceEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
productPriceQueryWrapper="asc".equals(productPricePagination.getSort().toLowerCase())?productPriceQueryWrapper.orderByAsc(value):productPriceQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(dataType)){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ProductPriceEntity> page=new Page<>(productPricePagination.getCurrentPage(), productPricePagination.getPageSize());
IPage<ProductPriceEntity> userIPage=this.page(page, productPriceQueryWrapper);
return productPricePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<ProductPriceEntity> list = new ArrayList();
return productPricePagination.setData(list, list.size());
}
}else{
return this.list(productPriceQueryWrapper);
}
}
@Override
public ProductPriceEntity getInfo(String id){
QueryWrapper<ProductPriceEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ProductPriceEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(ProductPriceEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, ProductPriceEntity entity){
return this.updateById(entity);
}
@Override
public void delete(ProductPriceEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(ProductPriceForm 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.getPrice())){
return "价格不能为空";
}
return countRecover;
}
/**
* ()
* @param id
* @param productPriceForm
* @return
*/
@Override
@Transactional
public void saveOrUpdate(ProductPriceForm productPriceForm,String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
productPriceForm = JsonUtil.getJsonToBean(
generaterSwapUtil.swapDatetime(ProductPriceConstant.getFormData(),productPriceForm),ProductPriceForm.class);
ProductPriceEntity entity = JsonUtil.getJsonToBean(productPriceForm, ProductPriceEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;
entity.setPriceNo(generaterSwapUtil.getBillNumber("jiageguanli", false));
entity.setId(mainId);
entity.setVersion(0);
}else{
entity.setPriceNo(generaterSwapUtil.getBillNumber("jiageguanli", false));
}
this.saveOrUpdate(entity);
}
@Override
public List<ProductPriceEntity> getProductpriceIndexList(ProductPricePagination productPricePagination) {
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 ? ProductPriceConstant.getAppColumnData() : ProductPriceConstant.getColumnData();
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(columnData, ColumnDataModel.class);
String ruleJson = !isPc ? JsonUtil.getObjectToString(columnDataModel.getRuleListApp()) : JsonUtil.getObjectToString(columnDataModel.getRuleList());
int total=0;
int productPriceNum =0;
QueryWrapper<ProductPriceEntity> productPriceQueryWrapper=new QueryWrapper<>();
List<String> allSuperIDlist = new ArrayList<>();
String superOp ="";
if (ObjectUtil.isNotEmpty(productPricePagination.getSuperQueryJson())){
List<String> allSuperList = new ArrayList<>();
List<List<String>> intersectionSuperList = new ArrayList<>();
String queryJson = productPricePagination.getSuperQueryJson();
SuperJsonModel superJsonModel = JsonUtil.getJsonToBean(queryJson, SuperJsonModel.class);
int superNum = 0;
QueryWrapper<ProductPriceEntity> productPriceSuperWrapper = new QueryWrapper<>();
productPriceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productPriceSuperWrapper,ProductPriceEntity.class,queryJson,"0"));
int productPriceNum1 = productPriceSuperWrapper.getExpression().getNormal().size();
if (productPriceNum1>0){
List<String> productPriceList =this.list(productPriceSuperWrapper).stream().map(ProductPriceEntity::getId).collect(Collectors.toList());
allSuperList.addAll(productPriceList);
intersectionSuperList.add(productPriceList);
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<ProductPriceEntity> productPriceSuperWrapper = new QueryWrapper<>();
productPriceSuperWrapper = generaterSwapUtil.getCondition(new QueryModel(productPriceSuperWrapper,ProductPriceEntity.class,ruleJson,"0"));
int productPriceNum1 = productPriceSuperWrapper.getExpression().getNormal().size();
if (productPriceNum1>0){
List<String> productPriceList =this.list(productPriceSuperWrapper).stream().map(ProductPriceEntity::getId).collect(Collectors.toList());
allRuleList.addAll(productPriceList);
intersectionRuleList.add(productPriceList);
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 productPriceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productPriceQueryWrapper,ProductPriceEntity.class,productPricePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productPriceObj)){
return new ArrayList<>();
} else {
productPriceQueryWrapper = (QueryWrapper<ProductPriceEntity>)productPriceObj;
if( productPriceQueryWrapper.getExpression().getNormal().size()>0){
productPriceNum++;
}
}
}
}
if(!isPc && appPermission){
if (!userProvider.get().getIsAdministrator()){
Object productPriceObj=generaterSwapUtil.getAuthorizeCondition(new QueryModel(productPriceQueryWrapper,ProductPriceEntity.class,productPricePagination.getMenuId(),"0"));
if (ObjectUtil.isEmpty(productPriceObj)){
return new ArrayList<>();
} else {
productPriceQueryWrapper = (QueryWrapper<ProductPriceEntity>)productPriceObj;
if( productPriceQueryWrapper.getExpression().getNormal().size()>0){
productPriceNum++;
}
}
}
}
if(isPc){
if(ObjectUtil.isNotEmpty(productPricePagination.getPriceType())){
productPriceNum++;
productPriceQueryWrapper.lambda().eq(ProductPriceEntity::getPriceType,productPricePagination.getPriceType());
}
if(ObjectUtil.isNotEmpty(productPricePagination.getStartTime())){
productPriceNum++;
List StartTimeList = JsonUtil.getJsonToList(productPricePagination.getStartTime(),String.class);
Long fir = Long.valueOf(String.valueOf(StartTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(StartTimeList.get(1)));
productPriceQueryWrapper.lambda().ge(ProductPriceEntity::getStartTime, new Date(fir))
.le(ProductPriceEntity::getStartTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(productPricePagination.getEndTime())){
productPriceNum++;
List EndTimeList = JsonUtil.getJsonToList(productPricePagination.getEndTime(),String.class);
Long fir = Long.valueOf(String.valueOf(EndTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(EndTimeList.get(1)));
productPriceQueryWrapper.lambda().ge(ProductPriceEntity::getEndTime, new Date(fir))
.le(ProductPriceEntity::getEndTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);
if (total>0){
if (intersection.size()==0){
intersection.add("jnpfNullList");
}
productPriceQueryWrapper.lambda().in(ProductPriceEntity::getId, intersection);
}
//是否有高级查询
if (StringUtil.isNotEmpty(superOp)){
if (allSuperIDlist.size()==0){
allSuperIDlist.add("jnpfNullList");
}
List<String> finalAllSuperIDlist = allSuperIDlist;
productPriceQueryWrapper.lambda().and(t->t.in(ProductPriceEntity::getId, finalAllSuperIDlist));
}
//是否有数据过滤查询
if (StringUtil.isNotEmpty(ruleOp)){
if (allRuleIDlist.size()==0){
allRuleIDlist.add("jnpfNullList");
}
List<String> finalAllRuleIDlist = allRuleIDlist;
productPriceQueryWrapper.lambda().and(t->t.in(ProductPriceEntity::getId, finalAllRuleIDlist));
}
//假删除标志
productPriceQueryWrapper.lambda().isNull(ProductPriceEntity::getDeleteMark);
//排序
if(StringUtil.isEmpty(productPricePagination.getSidx())){
productPriceQueryWrapper.lambda().orderByDesc(ProductPriceEntity::getId);
}else{
try {
String sidx = productPricePagination.getSidx();
String[] strs= sidx.split("_name");
ProductPriceEntity productPriceEntity = new ProductPriceEntity();
Field declaredField = productPriceEntity.getClass().getDeclaredField(strs[0]);
declaredField.setAccessible(true);
String value = declaredField.getAnnotation(TableField.class).value();
productPriceQueryWrapper="asc".equals(productPricePagination.getSort().toLowerCase())?productPriceQueryWrapper.orderByAsc(value):productPriceQueryWrapper.orderByDesc(value);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
if("0".equals(productPricePagination.getDataType())){
if((total>0 && AllIdList.size()>0) || total==0){
Page<ProductPriceEntity> page=new Page<>(productPricePagination.getCurrentPage(), productPricePagination.getPageSize());
// IPage<ProductPriceEntity> userIPage=this.page(page, productPriceQueryWrapper);
IPage<ProductPriceEntity> userIPage = productPriceMapper.queryByKeyword(page, productPricePagination, productPriceQueryWrapper);
return productPricePagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else{
List<ProductPriceEntity> list = new ArrayList();
return productPricePagination.setData(list, list.size());
}
}else{
return this.list(productPriceQueryWrapper);
}
}
}

@ -0,0 +1,396 @@
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.productprice.*;
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;
/**
* ProductPrice
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-21
*/
@Slf4j
@RestController
@Tag(name = "ProductPrice" , description = "scm")
@RequestMapping("/api/scm/ProductPrice")
public class ProductPriceController {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ProductPriceService productPriceService;
@Autowired
private ConfigValueUtil configValueUtil;
/**
*
*
* @param productPricePagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getList")
public ActionResult list(@RequestBody ProductPricePagination productPricePagination)throws IOException{
List<ProductPriceEntity> list= productPriceService.getList(productPricePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ProductPriceEntity entity : list) {
Map<String, Object> productPriceMap=JsonUtil.entityToMap(entity);
productPriceMap.put("id", productPriceMap.get("id"));
//副表数据
//子表数据
realList.add(productPriceMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ProductPriceConstant.getFormData(), ProductPriceConstant.getColumnData(), productPricePagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(productPricePagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param productPricePagination
* @return
*/
@Operation(summary = "获取列表")
@PostMapping("/getProductpriceIndexList")
public ActionResult getProductpriceIndexList(@RequestBody ProductPricePagination productPricePagination)throws IOException{
List<ProductPriceEntity> list= productPriceService.getList(productPricePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ProductPriceEntity entity : list) {
Map<String, Object> productPriceMap=JsonUtil.entityToMap(entity);
productPriceMap.put("id", productPriceMap.get("id"));
//副表数据
//子表数据
realList.add(productPriceMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ProductPriceConstant.getFormData(), ProductPriceConstant.getColumnData(), productPricePagination.getModuleId(),false);
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(productPricePagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
*
*
* @param productPriceForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create(@RequestBody @Valid ProductPriceForm productPriceForm) {
String b = productPriceService.checkForm(productPriceForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
productPriceService.saveOrUpdate(productPriceForm, null ,true);
}catch(Exception e){
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody ProductPricePagination productPricePagination) throws IOException {
if (StringUtil.isEmpty(productPricePagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<ProductPriceEntity> list= productPriceService.getList(productPricePagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (ProductPriceEntity entity : list) {
Map<String, Object> productPriceMap=JsonUtil.entityToMap(entity);
productPriceMap.put("id", productPriceMap.get("id"));
//副表数据
//子表数据
realList.add(productPriceMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, ProductPriceConstant.getFormData(), ProductPriceConstant.getColumnData(), productPricePagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(productPricePagination.getSelectKey())?productPricePagination.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 "priceType" :
entitys.add(new ExcelExportEntity("价格类型" ,"priceType"));
break;
case "priceNo" :
entitys.add(new ExcelExportEntity("价格编号" ,"priceNo"));
break;
case "makerId" :
entitys.add(new ExcelExportEntity("报价方" ,"makerId"));
break;
case "startTime" :
entitys.add(new ExcelExportEntity("有效时间开始" ,"startTime"));
break;
case "endTime" :
entitys.add(new ExcelExportEntity("有效时间结束" ,"endTime"));
break;
case "makerName" :
entitys.add(new ExcelExportEntity("报价方名称" ,"makerName"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "productId" :
entitys.add(new ExcelExportEntity("商品" ,"productId"));
break;
case "pricingUnitId" :
entitys.add(new ExcelExportEntity("计价单位" ,"pricingUnitId"));
break;
case "price" :
entitys.add(new ExcelExportEntity("价格" ,"price"));
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(ProductPriceConstant.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 productPriceForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ProductPriceForm productPriceForm,
@RequestParam(value = "isImport", required = false) boolean isImport){
productPriceForm.setId(id);
if (!isImport) {
String b = productPriceService.checkForm(productPriceForm,1);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
}
ProductPriceEntity entity= productPriceService.getInfo(id);
if(entity!=null){
try{
productPriceService.saveOrUpdate(productPriceForm,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){
ProductPriceEntity entity= productPriceService.getInfo(id);
if(entity!=null){
//假删除
entity.setDeleteMark(1);
productPriceService.update(id,entity);
}
return ActionResult.success("删除成功");
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
ProductPriceEntity entity= productPriceService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> productPriceMap=JsonUtil.entityToMap(entity);
productPriceMap.put("id", productPriceMap.get("id"));
//副表数据
//子表数据
productPriceMap = generaterSwapUtil.swapDataDetail(productPriceMap,ProductPriceConstant.getFormData(),"529565976849564293",false);
return ActionResult.success(productPriceMap);
}
/**
* ()
* 使-
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
ProductPriceEntity entity= productPriceService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> productPriceMap=JsonUtil.entityToMap(entity);
productPriceMap.put("id", productPriceMap.get("id"));
//副表数据
//子表数据
productPriceMap = generaterSwapUtil.swapDataForm(productPriceMap,ProductPriceConstant.getFormData(),ProductPriceConstant.TABLEFIELDKEY,ProductPriceConstant.TABLERENAMES);
return ActionResult.success(productPriceMap);
}
}

@ -0,0 +1,69 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
*
*
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-21
*/
@Data
@TableName("jg_product_price")
public class ProductPriceEntity {
@TableId(value ="ID" )
private String id;
@TableField(value = "PRICE_NO" , updateStrategy = FieldStrategy.IGNORED)
private String priceNo;
@TableField(value = "PRODUCT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String productId;
@TableField("PRODUCT_NAME")
private String productName;
@TableField("SPEC")
private String spec;
@TableField(value = "PRICE_TYPE" , updateStrategy = FieldStrategy.IGNORED)
private String priceType;
@TableField(value = "MAKER_ID" , updateStrategy = FieldStrategy.IGNORED)
private String makerId;
@TableField(value = "MAKER_NAME" , updateStrategy = FieldStrategy.IGNORED)
private String makerName;
@TableField(value = "START_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date startTime;
@TableField(value = "END_TIME" , updateStrategy = FieldStrategy.IGNORED)
private Date endTime;
@TableField(value = "PRICING_UNIT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String pricingUnitId;
@TableField(value = "PRICE" , updateStrategy = FieldStrategy.IGNORED)
private String price;
@TableField(value = "REMARK" , updateStrategy = FieldStrategy.IGNORED)
private String remark;
@TableField("F_CREATOR_TIME")
private Date creatorTime;
@TableField("F_CREATOR_USER_ID")
private String creatorUserId;
@TableField("F_LAST_MODIFY_TIME")
private Date lastModifyTime;
@TableField("F_LAST_MODIFY_USER_ID")
private String lastModifyUserId;
@TableField("F_DELETE_TIME")
private Date deleteTime;
@TableField("F_DELETE_USER_ID")
private String deleteUserId;
@TableField("F_DELETE_MARK")
private Integer deleteMark;
@TableField("F_TENANT_ID")
private String tenantId;
@TableField("COMPANY_ID")
private String companyId;
@TableField("DEPARTMENT_ID")
private String departmentId;
@TableField("F_FLOW_ID")
private String flowId;
@TableField("F_VERSION")
private Integer version;
@TableField("status")
private String status;
}

@ -0,0 +1,56 @@
package jnpf.model.productprice;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* ProductPrice
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-21
*/
@Data
public class ProductPriceForm {
/** 主键 */
private String id;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;
/** 价格类型 **/
@JsonProperty("priceType")
private String priceType;
/** 价格编号 **/
@JsonProperty("priceNo")
private String priceNo;
/** 报价方 **/
@JsonProperty("makerId")
private String makerId;
/** 有效时间开始 **/
@JsonProperty("startTime")
private String startTime;
/** 有效时间结束 **/
@JsonProperty("endTime")
private String endTime;
/** 报价方名称 **/
@JsonProperty("makerName")
private String makerName;
/** 备注 **/
@JsonProperty("remark")
private String remark;
/** 商品 **/
@JsonProperty("productId")
private String productId;
/** 计价单位 **/
@JsonProperty("pricingUnitId")
private Object pricingUnitId;
/** 价格 **/
@JsonProperty("price")
private String price;
/** 规格 **/
@JsonProperty("spec")
private String spec;
}

@ -0,0 +1,42 @@
package jnpf.model.productprice;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import jnpf.base.Pagination;
import java.util.List;
/**
*
* ProductPrice
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-21
*/
@Data
public class ProductPricePagination 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("priceType")
private Object priceType;
/** 有效时间开始 */
@JsonProperty("startTime")
private Object startTime;
/** 有效时间结束 */
@JsonProperty("endTime")
private Object endTime;
@JsonProperty("spec")
private String spec;
}

@ -0,0 +1,170 @@
<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-width="0">
<JnpfGroupTitle
contentPosition="left" :closable= "false" content ="基本信息" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="价格类型"
prop="priceType" >
<p>{{ dataForm.priceType }} </p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="价格编号"
prop="priceNo" >
<p>{{dataForm.priceNo}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="报价方"
prop="makerId" >
<p>{{dataForm.makerId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="有效时间开始"
prop="startTime" >
<p>{{dataForm.startTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="有效时间结束"
prop="endTime" >
<p>{{dataForm.endTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="报价方名称"
prop="makerName" >
<p>{{dataForm.makerName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label="备注"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="商品"
prop="productId" >
<p>{{dataForm.productId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="计价单位"
prop="pricingUnitId" >
<p>{{dataForm.pricingUnitId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" >
<jnpf-form-tip-item label="价格"
prop="price" >
<p>{{dataForm.price}}</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 :'',
priceType : "2",
priceNo : '',
makerId : "",
startTime : '',
endTime : '',
makerName : "",
remark : '',
productId : "",
pricingUnitId : "",
price : '',
},
priceTypeOptions:[{"fullName":"采购价格","id":"1"},{"fullName":"销售价格","id":"2"}],
priceTypeProps:{"label":"fullName","value":"id" },
pricingUnitIdProps:{"label":"unit_name","value":"id" },
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
goBack() {
this.$emit('refresh')
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/scm/ProductPrice/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,631 @@
<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
<div class="JNPF-common-page-header">
<el-page-header @back="goBack" :content="!dataForm.id ? '新建':'编辑'" />
<div class="options">
<el-dropdown class="dropdown" placement="bottom">
<el-button style="width:70px">
<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<template v-if="dataForm.id">
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
{{'上一条'}}
</el-dropdown-item>
<el-dropdown-item @click.native="next" :disabled='nextDis'>
{{'下一条'}}
</el-dropdown-item>
</template>
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
:disabled='btnLoading'>
{{!dataForm.id ?'确定并新增':'确定并继续'}}</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled='continueBtnLoading'>
</el-button>
<el-button @click="goBack"> </el-button>
</div>
</div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="基本信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="价格类型" prop="priceType">
<JnpfRadio v-model="dataForm.priceType" @change="changeData('priceType',-1)" optionType="button"
direction="horizontal" size="medium" :options="priceTypeOptions" :props="priceTypeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格编号" prop="priceNo">
<JnpfInput v-model="dataForm.priceNo" @change="changeData('priceNo',-1)" placeholder="系统自动生成" readonly
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="报价方" prop="makerId" v-if="dataForm.priceType == 2">
<JnpfPopupSelect v-model="dataForm.makerId" @change="makerChangeData" :rowIndex="null"
:formData="dataForm" :templateJson="interfaceRes.makerId" placeholder="请选择" propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='makerId'
interfaceId="520962013808039429" :pageSize="20" :columnOptions="makerIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
<jnpf-form-tip-item label="报价方" prop="makerId" v-if="dataForm.priceType == 1">
<JnpfPopupSelect v-model="dataForm.makerId" @change="makerChangeData" :rowIndex="null"
:formData="dataForm" :templateJson="interfaceRes.makerId" placeholder="请选择" propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='makerId'
interfaceId="522417703080700549" :pageSize="20" :columnOptions="makerIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="有效时间">
<!-- <JnpfDatePicker v-model="dataForm.startTime" @change="changeData('startTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择"
clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
</JnpfDatePicker> -->
<el-date-picker v-model="operationDate" type="daterange" start-placeholder=""
end-placeholder="结束日期" value-format="yyyy-MM-dd">
</el-date-picker>
</jnpf-form-tip-item>
</el-col>
<!-- <el-col :span="8">
<jnpf-form-tip-item label="有效时间结束" prop="endTime">
<JnpfDatePicker v-model="dataForm.endTime" @change="changeData('endTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择"
clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col> -->
<!-- <el-col :span="8">
<jnpf-form-tip-item label="报价方名称" prop="makerName">
<JnpfPopupSelect v-model="dataForm.makerName" @change="changeData('makerName',-1)" :rowIndex="null"
:formData="dataForm" :templateJson="interfaceRes.makerName" placeholder="请选择" propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='makerName'
interfaceId="522417703080700549" :pageSize="20" :columnOptions="makerNamecolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</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="请输入"
:style='{"width":"100%"}' true type="textarea" :autosize='{"minRows":4,"maxRows":4}'>
</JnpfTextarea>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="商品" prop="productId">
<JnpfPopupSelect v-model="dataForm.productId" @change="productChangeData" :rowIndex="null"
:formData="dataForm" :templateJson="interfaceRes.productId" placeholder="请选择" propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='productId'
interfaceId="529919666429100229" :pageSize="20" :columnOptions="productIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="计价单位" prop="pricingUnitId">
<JnpfSelect v-model="dataForm.pricingUnitId" @change="changeData('pricingUnitId',-1)" placeholder="请选择"
disabled clearable :style='{"width":"100%"}' :options="pricingUnitIdOptions"
:props="pricingUnitIdProps">
</JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
<jnpf-form-tip-item label="价格" prop="price">
<JnpfInput v-model="dataForm.price" @change="changeData('price',-1)" placeholder="请输入" clearable
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
@select="addForSelect" @close="selectDialogVisible=false" />
</el-row>
</div>
</transition>
</template>
<script>
import request from '@/utils/request'
import {
mapGetters
} from "vuex";
import {
getDataInterfaceRes
} from '@/api/systemData/dataInterface'
import {
getDictionaryDataSelector
} from '@/api/systemData/dictionary'
import {
getDefaultCurrentValueUserId
} from '@/api/permission/user'
import {
getDefaultCurrentValueDepartmentId
} from '@/api/permission/organize'
import {
getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime
} from '@/components/Generator/utils/index.js'
import {
thousandsFormat
} from "@/components/Generator/utils/index"
export default {
components: {},
props: [],
data() {
return {
operationDate: [],
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: {
priceType: "1",
priceNo: undefined,
makerId: undefined,
startTime: undefined,
endTime: undefined,
makerName: undefined,
remark: undefined,
spec: undefined,
productId: undefined,
pricingUnitId: undefined,
price: undefined,
version: 0,
},
tableRequiredData: {},
dataRule: {
priceType: [{
required: true,
message: '请至少选择一个',
trigger: 'change'
}, ],
makerId: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
startTime: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
endTime: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
productId: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
price: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
},
priceTypeOptions: [{
"fullName": "采购价格",
"id": "1"
}, {
"fullName": "销售价格",
"id": "2"
}],
priceTypeProps: {
"label": "fullName",
"value": "id"
},
makerIdcolumnOptions: [{
"label": "名称",
"value": "name"
}, ],
makerNamecolumnOptions: [{
"label": "名称",
"value": "name"
}, ],
productIdcolumnOptions: [{
"label": "名称",
"value": "name"
}, ],
pricingUnitIdOptions: [],
pricingUnitIdProps: {
"label": "unit_name",
"value": "id"
},
childIndex: -1,
isEdit: false,
interfaceRes: {
priceType: [],
priceNo: [],
makerId: [],
startTime: [],
endTime: [],
makerName: [],
remark: [],
spec: [],
productId: [],
pricingUnitId: [],
price: [],
},
}
},
computed: {
...mapGetters(['userInfo'])
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
makerChangeData(model, row){
this.dataForm.makerName = row.name;
},
productChangeData(model, row){
this.dataForm.pricingUnitId = row.product_unitwarehouse_id;
this.dataForm.spec = row.spec;
},
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/ProductPrice/' + 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.getpricingUnitIdOptions();
},
getpricingUnitIdOptions() {
const index = this.childIndex
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.pricingUnitId))
for (let i = 0; i < templateJsonList.length; i++) {
let json = templateJsonList[i];
if (json.relationField) {
let relationFieldAll = json.relationField.split("-");
let val = json.defaultValue;
if (relationFieldAll.length > 1 && index > -1) {
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ?
this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
} else {
val = this.dataForm[relationFieldAll]
}
json.defaultValue = val
}
}
let template = {
paramList: templateJsonList
}
getDataInterfaceRes('529938341609623877', template).then(res => {
let data = res.data
this.pricingUnitIdOptions = data
this.changeDataFormData(1, 'pricingUnitId', 'pricingUnitId', index, '')
})
},
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/ProductPrice/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
} else {
this.clearData()
this.initDefaultData()
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate((valid) => {
if (valid) {
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/scm/ProductPrice',
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/ProductPrice/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
}
})
}).catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
}
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList() {
if (this.operationDate && this.operationDate.length) {
this.dataForm.startTime = this.operationDate[0]
this.dataForm.endTime = this.operationDate[1]
} else {
this.startTime = ''
this.endTime = ''
}
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.operationDate = [];
if (this.dataForm.startTime && this.dataForm.endTime) {
this.operationDate[0] = new Date(this.dataForm.startTime)
this.operationDate[1] = new Date(this.dataForm.endTime)
}
this.isEdit = true
this.dataAll()
this.childIndex = -1
},
},
}
</script>

@ -0,0 +1,538 @@
<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="价格类型">
<JnpfSelect v-model="query.priceType" placeholder="请选择" clearable :options="priceTypeOptions"
:props="priceTypeProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="有效时间开始">
<JnpfDateRangePicker v-model="query.startTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="有效时间结束">
<JnpfDateRangePicker v-model="query.endTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" 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 label="价格类型" prop="priceType" algin="left">
<template slot-scope="scope">
{{ scope.row.priceType}}
</template>
</el-table-column>
<el-table-column prop="productId" label="商品" align="left">
</el-table-column>
<el-table-column prop="makerName" label="报价方" align="left">
</el-table-column>
<el-table-column prop="startTime" label="有效时间开始" align="left">
</el-table-column>
<el-table-column prop="endTime" label="有效时间结束" align="left">
</el-table-column>
<el-table-column prop="price" label="价格" align="left">
</el-table-column>
<el-table-column prop="priceNo" label="价格编号" align="left">
</el-table-column>
<el-table-column prop="pricingUnitId" 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,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
priceType: undefined,
startTime: undefined,
endTime: 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,
priceTypeOptions: [{
"fullName": "采购价格",
"id": "1"
}, {
"fullName": "销售价格",
"id": "2"
}],
priceTypeProps: {
"label": "fullName",
"value": "id"
},
pricingUnitIdOptions: [],
pricingUnitIdProps: {
"label": "unit_name",
"value": "id"
},
interfaceRes: {
makerId: [],
makerName: [],
productId: [],
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config = {
treeInterfaceId: "",
treeTemplateJson: []
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({
column
}) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
goDetail(id) {
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({
column,
prop,
order
}) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: '529565976849564293',
type: 1,
};
request({
url: `/api/scm/ProductPrice/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/ProductPrice/${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/ProductPrice")
})
},
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/ProductPrice/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/ProductPrice/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>

@ -0,0 +1,538 @@
<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="价格类型">
<JnpfSelect v-model="query.priceType" placeholder="请选择" clearable :options="priceTypeOptions"
:props="priceTypeProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="有效时间开始">
<JnpfDateRangePicker v-model="query.startTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="有效时间结束">
<JnpfDateRangePicker v-model="query.endTime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期">
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()"></el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"></el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<!-- <div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" 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 label="价格类型" prop="priceType" algin="left">
<template slot-scope="scope">
{{ scope.row.priceType}}
</template>
</el-table-column>
<el-table-column prop="productId" label="商品" align="left">
</el-table-column>
<el-table-column prop="makerName" label="报价方" align="left">
</el-table-column>
<el-table-column prop="startTime" label="有效时间开始" align="left">
</el-table-column>
<el-table-column prop="endTime" label="有效时间结束" align="left">
</el-table-column>
<el-table-column prop="price" label="价格" align="left">
</el-table-column>
<el-table-column prop="priceNo" label="价格编号" align="left">
</el-table-column>
<el-table-column prop="pricingUnitId" 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,
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
priceType: undefined,
startTime: undefined,
endTime: 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,
priceTypeOptions: [{
"fullName": "采购价格",
"id": "1"
}, {
"fullName": "销售价格",
"id": "2"
}],
priceTypeProps: {
"label": "fullName",
"value": "id"
},
pricingUnitIdOptions: [],
pricingUnitIdProps: {
"label": "unit_name",
"value": "id"
},
interfaceRes: {
makerId: [],
makerName: [],
productId: [],
},
}
},
computed: {
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
}
},
created() {
this.getColumnList(),
this.initSearchDataAndListData()
this.queryData = JSON.parse(JSON.stringify(this.query))
},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.toFormDetailVisible = true
this.$nextTick(() => {
this.$refs.toFormDetail.init(formData, modelId, defaultValue)
})
})
},
toggleTreeExpand(expands) {
this.refreshTree = false
this.expandsTree = expands
this.$nextTick(() => {
this.refreshTree = true
this.$nextTick(() => {
this.$refs.treeBox.setCurrentKey(null)
})
})
},
filterNode(value, data) {
if (!value) return true;
return data[this.treeProps.label].indexOf(value) !== -1;
},
loadNode(node, resolve) {
const nodeData = node.data
const config = {
treeInterfaceId: "",
treeTemplateJson: []
}
if (config.treeInterfaceId) {
//
if (config.treeTemplateJson && config.treeTemplateJson.length) {
for (let i = 0; i < config.treeTemplateJson.length; i++) {
const element = config.treeTemplateJson[i];
element.defaultValue = nodeData[element.relationField] || ''
}
}
//
let query = {
paramList: config.treeTemplateJson || [],
}
//
getDataInterfaceRes(config.treeInterfaceId, query).then(res => {
let data = res.data
if (Array.isArray(data)) {
resolve(data);
} else {
resolve([]);
}
})
}
},
getColumnList() {
//
this.columnOptions = this.transformColumnList(this.columnList)
},
transformColumnList(columnList) {
let list = []
for (let i = 0; i < columnList.length; i++) {
const e = columnList[i];
if (!e.prop.includes('-')) {
list.push(e)
} else {
let prop = e.prop.split('-')[0]
let label = e.label.split('-')[0]
let vModel = e.prop.split('-')[1]
let newItem = {
align: "center",
jnpfKey: "table",
prop,
label,
children: []
}
e.vModel = vModel
if (!this.expandObj.hasOwnProperty(`${prop}Expand`)) this.$set(this.expandObj, `${prop}Expand`, false)
if (!list.some(o => o.prop === prop)) list.push(newItem)
for (let i = 0; i < list.length; i++) {
if (list[i].prop === prop) {
list[i].children.push(e)
break
}
}
}
}
this.getMergeList(list)
this.getExportList(list)
return list
},
arraySpanMethod({
column
}) {
for (let i = 0; i < this.mergeList.length; i++) {
if (column.property == this.mergeList[i].prop) {
return [this.mergeList[i].rowspan, this.mergeList[i].colspan]
}
}
},
getMergeList(list) {
let newList = JSON.parse(JSON.stringify(list))
newList.forEach(item => {
if (item.children && item.children.length) {
let child = {
prop: item.prop + '-child-first'
}
item.children.unshift(child)
}
})
newList.forEach(item => {
if (item.children && item.children.length) {
item.children.forEach((child, index) => {
if (index == 0) {
this.mergeList.push({
prop: child.prop,
rowspan: 1,
colspan: item.children.length
})
} else {
this.mergeList.push({
prop: child.prop,
rowspan: 0,
colspan: 0
})
}
})
} else {
this.mergeList.push({
prop: item.prop,
rowspan: 1,
colspan: 1
})
}
})
},
getExportList(list) {
let exportList = []
for (let i = 0; i < list.length; i++) {
if (list[i].jnpfKey === 'table') {
for (let j = 0; j < list[i].children.length; j++) {
exportList.push(list[i].children[j])
}
} else {
exportList.push(list[i])
}
}
this.exportList = exportList
},
goDetail(id) {
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(id)
})
},
sortChange({
column,
prop,
order
}) {
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
this.listQuery.sidx = !order ? '' : prop
this.initData()
},
async initSearchDataAndListData() {
await this.initSearchData()
this.initData()
},
//
async initSearchData() {},
initData() {
this.listLoading = true;
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: '529565976849564293',
type: 1,
};
request({
url: `/api/scm/ProductPrice/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/ProductPrice/${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/ProductPrice")
})
},
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/ProductPrice/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/ProductPrice/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