班次配置

This commit is contained in:
z 2026-04-09 15:31:40 +08:00
parent 686bc8a4e3
commit 8cd7e5e3d0
38 changed files with 4375 additions and 682 deletions

View File

@ -1,7 +1,7 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.entity.OrderEntity;
import jnpf.entity.ExampleOrderEntity;
/**
* 业务订单 Mapper
@ -11,6 +11,6 @@ import jnpf.entity.OrderEntity;
* @作者 JNPF开发平台组
* @日期 2024-02-04
*/
public interface OrderMapper extends BaseMapper<OrderEntity> {
public interface ExampleOrderMapper extends BaseMapper<ExampleOrderEntity> {
}

View File

@ -0,0 +1,16 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.entity.ShiftConfigEntity;
/**
* 班次配置 Mapper
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
public interface ShiftConfigMapper extends BaseMapper<ShiftConfigEntity> {
}

View File

@ -0,0 +1,16 @@
package jnpf.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.entity.ShiftResultEntity;
/**
* 排班结果 Mapper
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
public interface ShiftResultMapper extends BaseMapper<ShiftResultEntity> {
}

View File

@ -1,32 +1,31 @@
package jnpf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.base.service.SuperService;
import jnpf.entity.OrderEntity;
import jnpf.entity.ExampleOrderEntity;
import jnpf.model.order.OrderForm;
import jnpf.model.order.OrderPagination;
import java.util.List;
/**
* 业务订单 Service
* 示例业务订单 Service
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2024-02-04
*/
public interface OrderService extends IService<OrderEntity> {
public interface ExampleOrderService extends IService<ExampleOrderEntity> {
List<OrderEntity> getList(OrderPagination orderPagination);
OrderEntity getInfo(String id);
List<ExampleOrderEntity> getList(OrderPagination orderPagination);
ExampleOrderEntity getInfo(String id);
void delete(OrderEntity entity);
void delete(ExampleOrderEntity entity);
void create(OrderEntity entity);
void create(ExampleOrderEntity entity);
boolean update(String id, OrderEntity entity);
boolean update(String id, ExampleOrderEntity entity);
String checkForm(OrderForm form, int i);
void saveOrUpdate(OrderForm orderForm,String id, boolean isSave) throws Exception;

View File

@ -1,7 +1,6 @@
package jnpf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.base.service.SuperService;
import jnpf.entity.OrderDetailEntity;
import jnpf.model.orderdetail.OrderDetailPagination;
@ -31,6 +30,6 @@ public interface OrderDetailService extends IService<OrderDetailEntity> {
* @param saleOrdId 销售订单ID
* @return 订单明细列表
*/
List<OrderDetailEntity> getListByOrderId(Integer saleOrdId);
List<OrderDetailEntity> getListByOrderId(String saleOrdId);
}

View File

@ -0,0 +1,29 @@
package jnpf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.entity.ShiftConfigEntity;
import jnpf.model.shift.ShiftConfigForm;
import jnpf.model.shift.ShiftConfigPagination;
import java.util.List;
/**
* 班次配置 Service
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
public interface ShiftConfigService extends IService<ShiftConfigEntity> {
List<ShiftConfigEntity> getList(ShiftConfigPagination shiftConfigPagination);
ShiftConfigEntity getInfo(String id);
void delete(ShiftConfigEntity entity);
void create(ShiftConfigEntity entity);
boolean update(String id, ShiftConfigEntity entity);
String checkForm(ShiftConfigForm form, int i);
void saveOrUpdate(ShiftConfigForm shiftConfigForm, String id, boolean isSave) throws Exception;
void deleteByChgClassType(String chgClassType);
}

View File

@ -0,0 +1,28 @@
package jnpf.service;
import com.baomidou.mybatisplus.extension.service.IService;
import jnpf.entity.ShiftResultEntity;
import jnpf.model.shiftresult.ShiftResultForm;
import jnpf.model.shiftresult.ShiftResultPagination;
import java.util.List;
/**
* 排班结果 Service
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
public interface ShiftResultService extends IService<ShiftResultEntity> {
List<ShiftResultEntity> getList(ShiftResultPagination shiftResultPagination);
ShiftResultEntity getInfo(String id);
void delete(ShiftResultEntity entity);
void create(ShiftResultEntity entity);
boolean update(String id, ShiftResultEntity entity);
String checkForm(ShiftResultForm form, int i);
void saveOrUpdate(ShiftResultForm shiftResultForm, String id, boolean isSave) throws Exception;
}

View File

@ -7,18 +7,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.base.service.SuperServiceImpl;
import jnpf.entity.OrderDetailEntity;
import jnpf.entity.OrderEntity;
import jnpf.mapper.OrderMapper;
import jnpf.entity.ExampleOrderEntity;
import jnpf.mapper.ExampleOrderMapper;
import jnpf.model.order.OrderForm;
import jnpf.model.order.OrderPagination;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.UserService;
import jnpf.service.ExampleOrderService;
import jnpf.service.OrderDetailService;
import jnpf.service.OrderService;
import jnpf.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -28,15 +26,15 @@ import java.util.List;
import java.util.stream.Collectors;
/**
* 业务订单 ServiceImpl
* 示例业务订单 ServiceImpl
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2024-02-04
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> implements OrderService {
@Service("exampleOrderService")
public class ExampleOrderServiceImpl extends ServiceImpl<ExampleOrderMapper, ExampleOrderEntity> implements ExampleOrderService {
@Resource
private UserService userService;
@Resource
@ -47,60 +45,60 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
@Resource
private OrderDetailService orderDetailService;
@Override
public List<OrderEntity> getList(OrderPagination orderPagination) {
LambdaQueryWrapper<OrderEntity> OrderWrapper=new LambdaQueryWrapper<>();
public List<ExampleOrderEntity> getList(OrderPagination orderPagination) {
LambdaQueryWrapper<ExampleOrderEntity> OrderWrapper=new LambdaQueryWrapper<>();
if(ObjectUtil.isNotEmpty(orderPagination.getOrdDate())){
List inParkTimeList = JsonUtil.getJsonToList(orderPagination.getOrdDate(),String.class);
Long fir = Long.valueOf(String.valueOf(inParkTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(inParkTimeList.get(1)));
OrderWrapper.ge(OrderEntity::getOrdDate, new Date(fir))
.le(OrderEntity::getOrdDate, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
OrderWrapper.ge(ExampleOrderEntity::getOrdDate, new Date(fir))
.le(ExampleOrderEntity::getOrdDate, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
if(ObjectUtil.isNotEmpty(orderPagination.getSaleOrdNo())){
OrderWrapper.like(OrderEntity::getSaleOrdNo,orderPagination.getSaleOrdNo());
OrderWrapper.like(ExampleOrderEntity::getSaleOrdNo,orderPagination.getSaleOrdNo());
}
if(ObjectUtil.isNotEmpty(orderPagination.getProjectName())){
OrderWrapper.like(OrderEntity::getProjectName,orderPagination.getProjectName());
OrderWrapper.like(ExampleOrderEntity::getProjectName,orderPagination.getProjectName());
}
if(ObjectUtil.isNotEmpty(orderPagination.getIsUrgent())){
OrderWrapper.eq(OrderEntity::getIsUrgent,orderPagination.getIsUrgent());
OrderWrapper.eq(ExampleOrderEntity::getIsUrgent,orderPagination.getIsUrgent());
}
if(ObjectUtil.isNotEmpty(orderPagination.getOrdStatus())){
OrderWrapper.eq(OrderEntity::getOrdStatus,orderPagination.getOrdStatus());
OrderWrapper.eq(ExampleOrderEntity::getOrdStatus,orderPagination.getOrdStatus());
}
if(ObjectUtil.isNotEmpty(orderPagination.getSaleManName())){
List<UserEntity> userList = userService.getUserByName(orderPagination.getSaleManName());
List<String> ids = userList.stream().map(UserEntity::getId).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(ids)){
OrderWrapper.in(OrderEntity::getSaleMan,ids);
OrderWrapper.in(ExampleOrderEntity::getSaleMan,ids);
}
}
OrderWrapper.isNull(OrderEntity::getDeleteMark);
OrderWrapper.orderByDesc(OrderEntity::getCreatorTime);
OrderWrapper.isNull(ExampleOrderEntity::getDeleteMark);
OrderWrapper.orderByDesc(ExampleOrderEntity::getCreatorTime);
if("0".equals(orderPagination.getDataType())){
Page<OrderEntity> page=new Page<>(orderPagination.getCurrentPage(), orderPagination.getPageSize());
IPage<OrderEntity> userIPage=this.page(page, OrderWrapper);
Page<ExampleOrderEntity> page=new Page<>(orderPagination.getCurrentPage(), orderPagination.getPageSize());
IPage<ExampleOrderEntity> userIPage=this.page(page, OrderWrapper);
return orderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
}else {
return this.list(OrderWrapper);
}
}
@Override
public OrderEntity getInfo(String id){
QueryWrapper<OrderEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(OrderEntity::getId,id);
public ExampleOrderEntity getInfo(String id){
QueryWrapper<ExampleOrderEntity> queryWrapper=new QueryWrapper<>();
queryWrapper.lambda().eq(ExampleOrderEntity::getId,id);
return this.getOne(queryWrapper);
}
@Override
public void create(OrderEntity entity){
public void create(ExampleOrderEntity entity){
this.save(entity);
}
@Override
public boolean update(String id, OrderEntity entity){
public boolean update(String id, ExampleOrderEntity entity){
return this.updateById(entity);
}
@Override
public void delete(OrderEntity entity){
public void delete(ExampleOrderEntity entity){
if(entity!=null){
this.removeById(entity.getId());
}
@ -129,7 +127,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
public void saveOrUpdate(OrderForm OrderForm, String id, boolean isSave) throws Exception{
UserInfo userInfo=userProvider.get();
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
OrderEntity entity = JsonUtil.getJsonToBean(OrderForm, OrderEntity.class);
ExampleOrderEntity entity = JsonUtil.getJsonToBean(OrderForm, ExampleOrderEntity.class);
if(isSave){
String mainId = RandomUtil.uuId() ;

View File

@ -2,12 +2,10 @@ package jnpf.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.service.SuperServiceImpl;
import jnpf.entity.OrderDetailEntity;
import jnpf.mapper.OrderDetailMapper;
import jnpf.model.orderdetail.OrderDetailPagination;
import jnpf.service.OrderDetailService;
import jnpf.util.StringUtil;
import org.springframework.stereotype.Service;
import java.util.List;
@ -29,11 +27,13 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
}
@Override
public List<OrderDetailEntity> getListByOrderId(Integer saleOrdId) {
public List<OrderDetailEntity> getListByOrderId(String saleOrdId) {
QueryWrapper<OrderDetailEntity> query = new QueryWrapper<>();
query.lambda().eq(OrderDetailEntity::getSaleOrdId, saleOrdId);
query.lambda().orderByAsc(OrderDetailEntity::getId);
query.lambda().orderByDesc(OrderDetailEntity::getCreatorTime);
return this.list(query);
}
}

View File

@ -0,0 +1,128 @@
package jnpf.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.entity.ShiftConfigEntity;
import jnpf.mapper.ShiftConfigMapper;
import jnpf.model.shift.ShiftConfigForm;
import jnpf.model.shift.ShiftConfigPagination;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.UserService;
import jnpf.service.ShiftConfigService;
import jnpf.util.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
* 班次配置 ServiceImpl
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Service("shiftConfigService")
public class ShiftConfigServiceImpl extends ServiceImpl<ShiftConfigMapper, ShiftConfigEntity> implements ShiftConfigService {
@Resource
private UserService userService;
@Resource
private GeneraterSwapUtil generaterSwapUtil;
@Resource
private UserProvider userProvider;
@Override
public List<ShiftConfigEntity> getList(ShiftConfigPagination shiftConfigPagination) {
LambdaQueryWrapper<ShiftConfigEntity> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotEmpty(shiftConfigPagination.getChgClassType())) {
wrapper.eq(ShiftConfigEntity::getChgClassType, shiftConfigPagination.getChgClassType());
}
wrapper.eq(ShiftConfigEntity::getDeleteMark,"0");
wrapper.orderByDesc(ShiftConfigEntity::getCreatorTime);
if ("0".equals(shiftConfigPagination.getDataType())) {
Page<ShiftConfigEntity> page = new Page<>(shiftConfigPagination.getCurrentPage(), shiftConfigPagination.getPageSize());
IPage<ShiftConfigEntity> userIPage = this.page(page, wrapper);
return shiftConfigPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
return this.list(wrapper);
}
}
@Override
public ShiftConfigEntity getInfo(String id) {
QueryWrapper<ShiftConfigEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ShiftConfigEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(ShiftConfigEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, ShiftConfigEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(ShiftConfigEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
@Override
public String checkForm(ShiftConfigForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
String chgClassType = form.getChgClassType();
if (StringUtil.isEmpty(chgClassType)) {
return "班次类型不能为空";
}
return countRecover;
}
@Override
@Transactional
public void saveOrUpdate(ShiftConfigForm shiftConfigForm, String id, boolean isSave) throws Exception {
List<ShiftConfigEntity> entityList = shiftConfigForm.getShiftConfigEntityList();
if (ObjectUtil.isEmpty(entityList)) {
return;
}
// 批量删除旧数据
LambdaUpdateWrapper<ShiftConfigEntity> deleteWrapper = new LambdaUpdateWrapper<>();
deleteWrapper.eq(ShiftConfigEntity::getChgClassType,shiftConfigForm.getChgClassType());
this.remove(deleteWrapper);
// 批量设置属性并保存新数据
entityList.forEach(entity -> {
entity.setChgClassType(shiftConfigForm.getChgClassType());
});
this.saveOrUpdateBatch(entityList);
}
@Override
public void deleteByChgClassType(String chgClassType) {
LambdaUpdateWrapper<ShiftConfigEntity> deleteWrapper = new LambdaUpdateWrapper<>();
deleteWrapper.eq(ShiftConfigEntity::getChgClassType,chgClassType);
this.remove(deleteWrapper);
}
}

View File

@ -0,0 +1,275 @@
package jnpf.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.base.UserInfo;
import jnpf.entity.ShiftConfigEntity;
import jnpf.entity.ShiftResultEntity;
import jnpf.mapper.ShiftConfigMapper;
import jnpf.mapper.ShiftResultMapper;
import jnpf.model.shiftresult.ShiftResultForm;
import jnpf.model.shiftresult.ShiftResultPagination;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.UserService;
import jnpf.service.ShiftResultService;
import jnpf.util.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* 排班结果 ServiceImpl
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Service("shiftResultService")
public class ShiftResultServiceImpl extends ServiceImpl<ShiftResultMapper, ShiftResultEntity> implements ShiftResultService {
@Resource
private UserService userService;
@Resource
private GeneraterSwapUtil generaterSwapUtil;
@Resource
private UserProvider userProvider;
@Resource
private ShiftConfigMapper shiftConfigMapper;
@Override
public List<ShiftResultEntity> getList(ShiftResultPagination shiftResultPagination) {
LambdaQueryWrapper<ShiftResultEntity> wrapper = new LambdaQueryWrapper<>();
if (ObjectUtil.isNotEmpty(shiftResultPagination.getYears())) {
long firstDayOfMonthTimestamp = Long.parseLong(shiftResultPagination.getYears().toString());
Date firstDayOfMonth = new Date(firstDayOfMonthTimestamp);
wrapper.eq(ShiftResultEntity::getMonth, firstDayOfMonth);
}
wrapper.eq(ShiftResultEntity::getDeleteMark,"0");
wrapper.orderByDesc(ShiftResultEntity::getCreatorTime);
if ("0".equals(shiftResultPagination.getDataType())) {
Page<ShiftResultEntity> page = new Page<>(shiftResultPagination.getCurrentPage(), shiftResultPagination.getPageSize());
IPage<ShiftResultEntity> userIPage = this.page(page, wrapper);
return shiftResultPagination.setData(userIPage.getRecords(), userIPage.getTotal());
} else {
return this.list(wrapper);
}
}
@Override
public ShiftResultEntity getInfo(String id) {
QueryWrapper<ShiftResultEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ShiftResultEntity::getId, id);
return this.getOne(queryWrapper);
}
@Override
public void create(ShiftResultEntity entity) {
this.save(entity);
}
@Override
public boolean update(String id, ShiftResultEntity entity) {
return this.updateById(entity);
}
@Override
public void delete(ShiftResultEntity entity) {
if (entity != null) {
this.removeById(entity.getId());
}
}
@Override
public String checkForm(ShiftResultForm form, int i) {
boolean isUp = StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
String id = "";
String countRecover = "";
if (isUp) {
id = form.getId();
}
if (ObjectUtil.isEmpty(form.getChgClassType())){
return "倒班类型不能为空";
}
if (ObjectUtil.isEmpty(form.getBgnDtime())){
return "排班开始日期不能为空";
}
LambdaQueryWrapper<ShiftConfigEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShiftConfigEntity::getChgClassType, form.getChgClassType());
if (shiftConfigMapper.selectCount(queryWrapper)==0){
return "该倒班类型"+("1".equals(form.getChgClassType())?"四班三倒":"三班两到")+"未配置班次信息";
}
return countRecover;
}
@Override
@Transactional
public void saveOrUpdate(ShiftResultForm shiftResultForm, String id, boolean isSave) throws Exception {
// 查询班次配置
LambdaQueryWrapper<ShiftConfigEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ShiftConfigEntity::getChgClassType, shiftResultForm.getChgClassType());
queryWrapper.orderByAsc(ShiftConfigEntity::getSeqNo);
List<ShiftConfigEntity> shiftConfigEntityList = shiftConfigMapper.selectList(queryWrapper);
if (ObjectUtil.isEmpty(shiftConfigEntityList)) {
throw new Exception("班次配置不存在");
}
// 确定每天的班次数量
int shiftsPerDay;
String chgClassType = shiftResultForm.getChgClassType();
if ("1".equals(chgClassType)) {
shiftsPerDay = 3; // 四班三倒每天3个班次
} else if ("2".equals(chgClassType)) {
shiftsPerDay = 2; // 三班两倒每天2个班次
} else {
throw new Exception("不支持的班次类型");
}
// 删除全表数据 - 先检查是否有数据避免不必要的删除操作
Long count = this.count();
if (count > 0) {
this.remove(new LambdaQueryWrapper<>());
}
// 预分配列表容量365天 × 每天班次避免扩容
int estimatedSize = 365 * shiftsPerDay;
List<ShiftResultEntity> shiftResultList = new ArrayList<>(estimatedSize);
// 从开始日期开始循环一年
Date startDate = shiftResultForm.getBgnDtime();
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
int totalDays = 365;
int configListSize = shiftConfigEntityList.size();
// 缓存月份的第一天避免重复计算同月的天数
Date currentMonth = null;
Date month = null;
for (int day = 0; day < totalDays; day++) {
// 当前日期
Date currentDate = calendar.getTime();
// 只在月份变化时计算月份的第一天
currentMonth = currentDate;
if (month == null || !month.equals(getFirstDayOfMonth(currentDate))) {
month = getFirstDayOfMonth(currentDate);
}
// 循环每天的班次
for (int shiftIndex = 0; shiftIndex < shiftsPerDay; shiftIndex++) {
// 按周期循环使用班次配置
// 例如8天周期四班三倒(24条配置)
// - 第0天使用索引 0,1,2
// - 第1天使用索引 3,4,5
// - ...
// - 第7天使用索引 21,22,23
// - 第8天回到索引 0,1,2循环
int configIndex = (day * shiftsPerDay + shiftIndex) % configListSize;
ShiftConfigEntity config = shiftConfigEntityList.get(configIndex);
// 创建排班结果实体
ShiftResultEntity resultEntity = new ShiftResultEntity();
resultEntity.setClassGroup(config.getClassGroup());
resultEntity.setClassRate(config.getClassRate());
// 解析时间并组合成完整日期时间
Date bgnDtime = combineDateAndTime(currentDate, config.getBgnDtime(), false);
Date endDtime = combineDateAndTime(currentDate, config.getEndDtime(), true);
resultEntity.setBgnDtime(bgnDtime);
resultEntity.setEndDtime(endDtime);
resultEntity.setMonth(month);
// 计算工作小时数
int shiftHour = calculateHours(config.getBgnDtime(), config.getEndDtime());
resultEntity.setShiftHour(shiftHour);
shiftResultList.add(resultEntity);
}
// 下一天
calendar.add(Calendar.DAY_OF_MONTH, 1);
}
// 批量保存设置批次大小为500平衡内存和性能
if (ObjectUtil.isNotEmpty(shiftResultList)) {
this.saveBatch(shiftResultList, 500);
}
}
/**
* 获取月份的第一天
*/
private Date getFirstDayOfMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
return calendar.getTime();
}
/**
* 组合日期和时间
* @param date 日期
* @param timeStr 时间字符串
* @param isEndTime 是否为结束时间只有结束时间是0点时才加一天
*/
private Date combineDateAndTime(Date date, String timeStr, boolean isEndTime) {
String[] timeParts = timeStr.split(":");
int hour = Integer.parseInt(timeParts[0]);
int minute = timeParts.length > 1 ? Integer.parseInt(timeParts[1]) : 0;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
// 只有结束时间是 0 点时日期才自动加一天
if (isEndTime && hour == 0 && minute == 0) {
calendar.add(Calendar.DAY_OF_MONTH, 1);
}
return calendar.getTime();
}
/**
* 计算小时数
*/
private int calculateHours(String startTime, String endTime) {
String[] startParts = startTime.split(":");
String[] endParts = endTime.split(":");
int startHour = Integer.parseInt(startParts[0]);
int startMinute = startParts.length > 1 ? Integer.parseInt(startParts[1]) : 0;
int endHour = Integer.parseInt(endParts[0]);
int endMinute = endParts.length > 1 ? Integer.parseInt(endParts[1]) : 0;
int totalMinutes = (endHour * 60 + endMinute) - (startHour * 60 + startMinute);
// 如果结果为负数说明跨天加上 24 小时
if (totalMinutes < 0) {
totalMinutes += 24 * 60;
}
return totalMinutes / 60;
}
}

View File

@ -1,25 +1,34 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.entity.DictionaryDataEntity;
import jnpf.base.service.DictionaryDataService;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.OrderEntity;
import jnpf.entity.ExampleOrderEntity;
import jnpf.entity.OrderDetailEntity;
import jnpf.model.order.OrderForm;
import jnpf.model.order.OrderPagination;
import jnpf.service.OrderService;
import jnpf.permission.entity.UserEntity;
import jnpf.permission.service.UserService;
import jnpf.service.ExampleOrderService;
import jnpf.service.OrderDetailService;
import jnpf.util.JsonUtil;
import jnpf.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -33,9 +42,13 @@ import java.util.stream.Collectors;
@RequestMapping("/api/example/exampleOrder")
public class ExampleOrderController {
@Autowired
private OrderService orderService;
@Resource
private ExampleOrderService orderService;
@Resource
private UserService userService;
@Resource
private OrderDetailService orderDetailService;
/**
* 列表
* @param orderPagination 分页查询对象
@ -43,12 +56,22 @@ public class ExampleOrderController {
*/
@Operation(summary = "获取订单列表")
@PostMapping("/getList")
public ActionResult getList(OrderPagination orderPagination) {
List<OrderEntity> list= orderService.getList(orderPagination);
List<Map<String, Object>> realList = list.stream()
.map(JsonUtil::entityToMap)
.collect(Collectors.toList());
public ActionResult getList(@RequestBody OrderPagination orderPagination) {
List<ExampleOrderEntity> list= orderService.getList(orderPagination);
List<Map<String, Object>> realList =new ArrayList<>();
for (ExampleOrderEntity entity : list) {
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
ExampleOrderMap.put("id", ExampleOrderMap.get("id"));
//子表数据
if (ObjectUtil.isNotEmpty(entity.getSaleMan())){
UserEntity byId = userService.getById(entity.getSaleMan());
if (ObjectUtil.isNotEmpty(byId)){
ExampleOrderMap.put("saleManName", byId.getRealName());
}
}
realList.add(ExampleOrderMap);
}
//返回对象
PageListVO vo = new PageListVO();
vo.setList(realList);
@ -74,7 +97,7 @@ public class ExampleOrderController {
return ActionResult.fail(b );
}
}
OrderEntity entity= orderService.getInfo(id);
ExampleOrderEntity entity= orderService.getInfo(id);
if(entity!=null){
try{
orderService.saveOrUpdate(orderForm,id,false);
@ -95,7 +118,7 @@ public class ExampleOrderController {
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){
OrderEntity entity = orderService.getInfo(id);
ExampleOrderEntity entity = orderService.getInfo(id);
if (entity != null) {
//假删除
entity.setDeleteMark(1);
@ -104,5 +127,48 @@ public class ExampleOrderController {
return ActionResult.success("删除成功");
}
/**
* 表单信息(详情页)
* 详情页面使用-转换数据
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id){
ExampleOrderEntity entity= orderService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
ExampleOrderMap.put("id", ExampleOrderMap.get("id"));
List<OrderDetailEntity> orderDetailList = orderDetailService.getListByOrderId(entity.getId());
ExampleOrderMap.put("orderDetailList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(orderDetailList)));
//副表数据
//子表数据
return ActionResult.success(ExampleOrderMap);
}
/**
* 获取详情(编辑页)
* 编辑页面使用-不转换数据
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id){
ExampleOrderEntity entity= orderService.getInfo(id);
if(entity==null){
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
ExampleOrderMap.put("id", ExampleOrderMap.get("id"));
List<OrderDetailEntity> orderDetailList = orderDetailService.getListByOrderId(entity.getId());
ExampleOrderMap.put("orderDetailList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(orderDetailList)));
//副表数据
//子表数据
return ActionResult.success(ExampleOrderMap);
}
}

View File

@ -60,7 +60,7 @@ public class OrderDetailController {
@Operation(summary = "根据订单ID获取明细列表")
@Parameter(name = "saleOrdId", description = "销售订单ID", required = true)
@GetMapping("/byOrder/{saleOrdId}")
public ActionResult<ListVO<OrderDetailVO>> getListByOrderId(@PathVariable Integer saleOrdId) {
public ActionResult<ListVO<OrderDetailVO>> getListByOrderId(@PathVariable String saleOrdId) {
List<OrderDetailEntity> entityList = orderDetailService.getListByOrderId(saleOrdId);
List<OrderDetailVO> voList = JsonUtil.getJsonToList(entityList, OrderDetailVO.class);
return ActionResult.success(new ListVO<>(voList));

View File

@ -0,0 +1,166 @@
package jnpf.controller;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.ShiftConfigEntity;
import jnpf.model.machine.MachineForm;
import jnpf.model.shift.ShiftConfigForm;
import jnpf.model.shift.ShiftConfigPagination;
import jnpf.service.ShiftConfigService;
import jnpf.util.JsonUtil;
import jnpf.util.StringUtil;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 班次配置 控制类
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Tag(name = "班次配置", description = "shiftConfig")
@RestController
@RequestMapping("/api/example/shiftConfig")
public class ShiftConfigController {
@Resource
private ShiftConfigService shiftConfigService;
/**
* 列表
* @param shiftConfigPagination 分页查询对象
* @return 列表结果集
*/
@Operation(summary = "获取班次配置列表")
@PostMapping("/getList")
public ActionResult getList(@RequestBody ShiftConfigPagination shiftConfigPagination) {
List<ShiftConfigEntity> list = shiftConfigService.getList(shiftConfigPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (ShiftConfigEntity entity : list) {
Map<String, Object> shiftConfigMap = JsonUtil.entityToMap(entity);
shiftConfigMap.put("id", shiftConfigMap.get("id"));
realList.add(shiftConfigMap);
}
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(shiftConfigPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param shiftConfigForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create( @RequestBody @Valid ShiftConfigForm shiftConfigForm) {
String b = shiftConfigService.checkForm(shiftConfigForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
shiftConfigService.saveOrUpdate(shiftConfigForm,null ,true);
}catch(Exception e){
e.printStackTrace();
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* 编辑
* @param id
* @param shiftConfigForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ShiftConfigForm shiftConfigForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
shiftConfigForm.setId(id);
if (!isImport) {
String b = shiftConfigService.checkForm(shiftConfigForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
ShiftConfigEntity entity = shiftConfigService.getInfo(id);
if (entity != null) {
try {
shiftConfigService.saveOrUpdate(shiftConfigForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
* 删除
* @param chgClassType
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{chgClassType}")
public ActionResult delete(@PathVariable("chgClassType") String chgClassType) {
if (ObjectUtil.isNotEmpty(chgClassType)) {
shiftConfigService.deleteByChgClassType(chgClassType);
}
return ActionResult.success("删除成功");
}
/**
* 表单信息(详情页)
* 详情页面使用-转换数据
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id) {
ShiftConfigEntity entity = shiftConfigService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> shiftConfigMap = JsonUtil.entityToMap(entity);
shiftConfigMap.put("id", shiftConfigMap.get("id"));
return ActionResult.success(shiftConfigMap);
}
/**
* 获取详情(编辑页)
* 编辑页面使用-不转换数据
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id) {
ShiftConfigEntity entity = shiftConfigService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> shiftConfigMap = JsonUtil.entityToMap(entity);
shiftConfigMap.put("id", shiftConfigMap.get("id"));
return ActionResult.success(shiftConfigMap);
}
}

View File

@ -0,0 +1,164 @@
package jnpf.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.ShiftResultEntity;
import jnpf.model.shift.ShiftConfigForm;
import jnpf.model.shiftresult.ShiftResultForm;
import jnpf.model.shiftresult.ShiftResultPagination;
import jnpf.service.ShiftResultService;
import jnpf.util.JsonUtil;
import jnpf.util.StringUtil;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 排班结果 控制类
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Tag(name = "排班结果", description = "shiftResult")
@RestController
@RequestMapping("/api/example/shiftResult")
public class ShiftResultController {
@Resource
private ShiftResultService shiftResultService;
/**
* 列表
* @param shiftResultPagination 分页查询对象
* @return 列表结果集
*/
@Operation(summary = "获取排班结果列表")
@PostMapping("/getList")
public ActionResult getList(@RequestBody ShiftResultPagination shiftResultPagination) {
List<ShiftResultEntity> list = shiftResultService.getList(shiftResultPagination);
List<Map<String, Object>> realList = new ArrayList<>();
for (ShiftResultEntity entity : list) {
Map<String, Object> shiftResultMap = JsonUtil.entityToMap(entity);
shiftResultMap.put("id", shiftResultMap.get("id"));
realList.add(shiftResultMap);
}
PageListVO vo = new PageListVO();
vo.setList(realList);
PaginationVO page = JsonUtil.getJsonToBean(shiftResultPagination, PaginationVO.class);
vo.setPagination(page);
return ActionResult.success(vo);
}
/**
* 创建
*
* @param shiftResultForm
* @return
*/
@PostMapping()
@Operation(summary = "创建")
public ActionResult create( @RequestBody @Valid ShiftResultForm shiftResultForm) {
String b = shiftResultService.checkForm(shiftResultForm,0);
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
try{
shiftResultService.saveOrUpdate(shiftResultForm,null ,true);
}catch(Exception e){
e.printStackTrace();
return ActionResult.fail("新增数据失败");
}
return ActionResult.success("创建成功");
}
/**
* 编辑
* @param id
* @param shiftResultForm
* @return
*/
@PutMapping("/{id}")
@Operation(summary = "更新")
public ActionResult update(@PathVariable("id") String id, @RequestBody @Valid ShiftResultForm shiftResultForm,
@RequestParam(value = "isImport", required = false) boolean isImport) {
shiftResultForm.setId(id);
if (!isImport) {
String b = shiftResultService.checkForm(shiftResultForm, 1);
if (StringUtil.isNotEmpty(b)) {
return ActionResult.fail(b);
}
}
ShiftResultEntity entity = shiftResultService.getInfo(id);
if (entity != null) {
try {
shiftResultService.saveOrUpdate(shiftResultForm, id, false);
} catch (Exception e) {
return ActionResult.fail("修改数据失败");
}
return ActionResult.success("更新成功");
} else {
return ActionResult.fail("更新失败,数据不存在");
}
}
/**
* 删除
* @param id
* @return
*/
@Operation(summary = "删除")
@DeleteMapping("/{id}")
public ActionResult delete(@PathVariable("id") String id) {
ShiftResultEntity entity = shiftResultService.getInfo(id);
if (entity != null) {
shiftResultService.delete(entity);
}
return ActionResult.success("删除成功");
}
/**
* 表单信息(详情页)
* 详情页面使用-转换数据
* @param id
* @return
*/
@Operation(summary = "表单信息(详情页)")
@GetMapping("/detail/{id}")
public ActionResult detailInfo(@PathVariable("id") String id) {
ShiftResultEntity entity = shiftResultService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> shiftResultMap = JsonUtil.entityToMap(entity);
shiftResultMap.put("id", shiftResultMap.get("id"));
return ActionResult.success(shiftResultMap);
}
/**
* 获取详情(编辑页)
* 编辑页面使用-不转换数据
* @param id
* @return
*/
@Operation(summary = "信息")
@GetMapping("/{id}")
public ActionResult info(@PathVariable("id") String id) {
ShiftResultEntity entity = shiftResultService.getInfo(id);
if (entity == null) {
return ActionResult.fail("表单数据不存在!");
}
Map<String, Object> shiftResultMap = JsonUtil.entityToMap(entity);
shiftResultMap.put("id", shiftResultMap.get("id"));
return ActionResult.success(shiftResultMap);
}
}

View File

@ -7,12 +7,12 @@ import java.math.BigDecimal;
import java.util.Date;
/**
* 业务订单表
* 示例业务订单表
*
*/
@Data
@TableName("tso_order")
public class OrderEntity {
public class ExampleOrderEntity {
@TableId(value = "id", type = IdType.AUTO)
private String id;
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)

View File

@ -0,0 +1,56 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 班次配置表
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
@TableName("tba_shift_config")
public class ShiftConfigEntity {
@TableId(value = "id", type = IdType.AUTO)
private String id;
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
private String creatorUserId;
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
private Date creatorTime;
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
private String lastModifyUserId;
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
private Date lastModifyTime;
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
private String deleteUserId;
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
private Date deleteTime;
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
@TableField(value = "f_flow_id")
private String flowId;
@TableField(value = "f_flow_task_id")
private String flowTaskId;
@TableField(value = "class_group", updateStrategy = FieldStrategy.IGNORED)
private String classGroup;
@TableField("class_rate")
private String classRate;
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
private Integer enabledStatus;
@TableField("remark")
private String remark;
@TableField("seq_no")
private Integer seqNo;
@TableField("bgn_dtime")
private String bgnDtime;
@TableField("end_dtime")
private String endDtime;
@TableField("chg_class_type")
private String chgClassType;
}

View File

@ -0,0 +1,56 @@
package jnpf.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 排班结果表
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
@TableName("tba_shift_result")
public class ShiftResultEntity {
@TableId(value = "id", type = IdType.AUTO)
private String id;
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
private String creatorUserId;
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
private Date creatorTime;
@TableField(value = "f_last_modify_user_id", fill = FieldFill.INSERT_UPDATE)
private String lastModifyUserId;
@TableField(value = "f_last_modify_time", fill = FieldFill.INSERT_UPDATE)
private Date lastModifyTime;
@TableField(value = "f_delete_user_id", fill = FieldFill.UPDATE)
private String deleteUserId;
@TableField(value = "f_delete_time", fill = FieldFill.UPDATE)
private Date deleteTime;
@TableField(value = "f_delete_mark", updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
@TableField(value = "f_flow_id")
private String flowId;
@TableField(value = "f_flow_task_id")
private String flowTaskId;
@TableField(value = "bgn_dtime", updateStrategy = FieldStrategy.IGNORED)
private Date bgnDtime;
@TableField(value = "end_dtime", updateStrategy = FieldStrategy.IGNORED)
private Date endDtime;
@TableField(value = "class_group", updateStrategy = FieldStrategy.IGNORED)
private String classGroup;
@TableField("class_rate")
private String classRate;
@TableField(value = "enabled_status", updateStrategy = FieldStrategy.IGNORED)
private Integer enabledStatus;
@TableField("remark")
private String remark;
@TableField(value = "shift_hour", updateStrategy = FieldStrategy.IGNORED)
private Integer shiftHour;
@TableField(value = "month", updateStrategy = FieldStrategy.IGNORED)
private Date month;
}

View File

@ -122,7 +122,7 @@ public class OrderForm {
@Schema(description = "流程任务ID")
private String flowTaskId;
@JsonProperty("OrderDetailList")
private List<OrderDetailEntity> OrderDetailList;
@JsonProperty("orderDetailList")
private List<OrderDetailEntity> orderDetailList;
}

View File

@ -0,0 +1,74 @@
package jnpf.model.shift;
import io.swagger.v3.oas.annotations.media.Schema;
import jnpf.entity.ShiftConfigEntity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 班次配置 Form
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
public class ShiftConfigForm {
@Schema(description = "主键")
private String id;
@Schema(description = "班次代码")
private String classGroup;
@Schema(description = "班次名称")
private String classRate;
@Schema(description = "开始时间")
private String bgnDtime;
@Schema(description = "结束时间")
private String endDtime;
@Schema(description = "班次类型")
private String chgClassType;
@Schema(description = "班次类型")
private String remark;
@Schema(description = "创建时间")
private Date creatorTime;
@Schema(description = "创建用户ID")
private String creatorUserId;
@Schema(description = "序列号")
private Integer seqNo;
@Schema(description = "最后修改时间")
private Date lastModifyTime;
@Schema(description = "最后修改用户ID")
private String lastModifyUserId;
@Schema(description = "删除时间")
private Date deleteTime;
@Schema(description = "删除用户ID")
private String deleteUserId;
@Schema(description = "删除标记")
private Integer deleteMark;
@Schema(description = "流程ID")
private String flowId;
@Schema(description = "流程任务ID")
private String flowTaskId;
@Schema(description = "明细集合")
private List<ShiftConfigEntity> shiftConfigEntityList;
}

View File

@ -0,0 +1,38 @@
package jnpf.model.shift;
import jnpf.base.Pagination;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 班次配置分页查询
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
public class ShiftConfigPagination 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;
@Schema(description = "班次代码")
private String shiftCode;
@Schema(description = "班次名称")
private String shiftName;
@Schema(description = "班次类型")
private String chgClassType;
}

View File

@ -0,0 +1,31 @@
package jnpf.model.shiftresult;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 排班结果 Form
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
public class ShiftResultForm {
@Schema(description = "主键")
private String id;
@Schema(description = "排班日期")
private Date bgnDtime;
@Schema(description = "班次代码")
private String chgClassType;
}

View File

@ -0,0 +1,50 @@
package jnpf.model.shiftresult;
import com.fasterxml.jackson.annotation.JsonProperty;
import jnpf.base.Pagination;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
/**
* 排班结果分页查询
*
* @版本 V3.5
* @版权 引迈信息技术有限公司https://www.jnpfsoft.com
* @作者 JNPF开发平台组
* @日期 2025-04-09
*/
@Data
public class ShiftResultPagination 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;
@Schema(description = "排班日期")
private Object shiftDate;
@Schema(description = "班次代码")
private String shiftCode;
@Schema(description = "班次名称")
private String shiftName;
@Schema(description = "用户姓名")
private String userName;
@Schema(description = "状态")
private String status;
/** 年月 */
@JsonProperty("years")
private Object years;
}

View File

@ -279,6 +279,16 @@ const jnpf = {
if (!cellValue) return ''
return dayjs(cellValue).format(format)
},
tableDateFormat3(row, column, cellValue) {
let format = 'HH:mm'
if (!cellValue) return ''
return dayjs(cellValue).format(format)
},
tableDateFormat4(row, column, cellValue) {
let format = 'YYYY-MM'
if (!cellValue) return ''
return dayjs(cellValue).format(format)
},
storageSet(obj) {
for (let i in obj) {
cacheItem(i, obj[i])

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +1,40 @@
<template>
<div class="JNPF-common-layout finalcheckdata_new">
<div class="JNPF-common-layout-center">
<el-row class="JNPF-common-search-box" :gutter="14">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent >
<el-col :span="8">
<el-form-item label="下单日期">
<JnpfDateRangePicker v-model="query.ordDate" format="yyyy-MM-dd"
startPlaceholder="开始日期" endPlaceholder="结束日期" />
</el-form-item>
</el-col>
<el-col :span="6" >
<el-col :span="8" >
<el-form-item label="订单编号">
<el-input v-model="query.saleOrdNo" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-col :span="8" >
<el-form-item label="项目名称">
<el-input v-model="query.projectName" placeholder="请输入" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="8">
<el-form-item label="是否急单">
<JnpfSelect v-model="query.isUrgent" placeholder="请选择" clearable :options="isUrgentOptions"
:props="isUrgentProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-col :span="8">
<el-form-item label="订单状态">
<JnpfSelect v-model="query.ordStatus" placeholder="请选择" clearable :options="ordStatusOptions"
:props="ordStatusProps">
</JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-col :span="8" >
<el-form-item label="业务员">
<el-input v-model="query.saleManName" placeholder="请输入" clearable> </el-input>
</el-form-item>
@ -88,6 +88,19 @@
<el-table-column label="操作" fixed="right" align="center" width="170">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
<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">
<el-dropdown-item @click.native="handleOrderChange(scope.row)">
订单变更
</el-dropdown-item>
<el-dropdown-item @click.native="handleDetail(scope.row)">
详情
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</JNPF-table>
@ -604,8 +617,30 @@ export default {
},
handleDelete(row) {
this.handleDel(row.id);
},
handleOrderChange(row) {
if (!row || !row.id) {
this.$message.warning('请选择订单')
return
}
this.$message.info('订单变更功能开发中')
},
handleDetail(row) {
if (!row || !row.id) {
this.$message.warning('请选择订单')
return
}
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(row.id)
})
}
},
};
</script>
<style scoped>
::v-deep .el-form-item__label {
text-align: left !important;
}
</style>

View File

@ -0,0 +1,97 @@
<template>
<el-select v-model="innerValue" :placeholder="placeholder" :clearable="clearable"
@change="onChange()" :multiple="multiple" :disabled="disabled" :filterable="filterable">
<el-option v-for="item in options" :key="item[props.value]" :label="item[props.label] +' ' + item[props.labels]"
:value="item[props.value]">
</el-option>
</el-select>
</template>
<script>
export default {
name: 'materialslect',
components: {},
props: {
value: {
default: undefined
},
options: {
type: Array,
default: () => []
},
placeholder: {
type: String,
default: '请选择'
},
disabled: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: true
},
props: {
label: "fullName",
value: "id"
}
},
data() {
return {
innerValue: this.value,
}
},
watch: {
value: {
handler(val) {
this.innerValue = val
},
immediate: true
},
},
computed: {},
mounted() { },
methods: {
onChange() {
if (this.multiple) this.innerValue = this.innerValue ? this.innerValue : []
if (!this.multiple) this.innerValue = this.innerValue ? this.innerValue : ""
this.$emit('input', this.innerValue)
this.$emit('change', this.innerValue)
},
}
}
</script>
<style lang="scss" scoped>
.input-number {
width: 100%;
border-radius: 0px !important;
>>> .el-input__inner {
border-radius: 0px !important;
}
}
.select-item {
display: block;
margin: 10px 0;
}
.select-border {
display: block;
margin: 8px 0;
}
.select-horizontal {
display: inline-block;
line-height: 1;
vertical-align: middle;
margin: 0 10px;
}
.vertical-button {
margin: 5px 0;
}
</style>

View File

@ -0,0 +1,198 @@
<template>
<el-dialog title="详情"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="1000px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="12" >
<jnpf-form-tip-item label="编号"
prop="schemeNo" >
<p>{{dataForm.schemeNo}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="名称"
prop="schemeName" >
<p>{{dataForm.schemeName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="适用类型"
prop="schemeType" >
<p>{{dataForm.schemeType==1?"原材料":dataForm.schemeType==2?"半成品":"成品"}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="产品大类"
prop="tiemClass" >
<p>{{dataForm.tiemClass}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="表单编号"
prop="formCode" >
<p>{{dataForm.formCode}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="执行标准"
prop="execStandard" >
<p>{{dataForm.execStandard}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="属性检测"
prop="isAttDet" >
<p>{{dataForm.isAttDet=='Y'?"是":"否"}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="描述"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="创建人"
prop="creatorUserId" >
<p>{{dataForm.creatorUserId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="创建时间"
prop="creatorTime" >
<p>{{dataForm.creatorTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.tableField114" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="itemId" label="检验项目" >
<template slot-scope="scope">
<el-link :underline="false" type="primary"
@click.native="toDetail(scope.row.itemId_id,'608540150753923141')">
{{scope.row.itemId}}</el-link>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" >
<template slot-scope="scope">
<p>{{scope.row.unit}}</p>
</template>
</el-table-column>
<el-table-column prop="standardValue" label="标准值" >
<template slot-scope="scope">
<p>{{scope.row.standardValue}}</p>
</template>
</el-table-column>
<el-table-column prop="upperLimit" label="上限值" >
<template slot-scope="scope">
<p>{{scope.row.upperLimit}}</p>
</template>
</el-table-column>
<el-table-column prop="lowerLimit" label="下限值" >
<template slot-scope="scope">
<p>{{scope.row.lowerLimit}}</p>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" >
<template slot-scope="scope">
<p>{{scope.row.remark}}</p>
</template>
</el-table-column>
<el-table-column prop="seqNo" label="展示顺序" >
<template slot-scope="scope">
<p>{{scope.row.seqNo}}</p>
</template>
</el-table-column>
</el-table>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
schemeNo : '',
schemeName : '',
schemeType : '',
remark : '',
creatorUserId : "",
creatorTime : "",
qa_scheme_base_twList:[],
},
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/example/Qa_scheme_base/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

View File

@ -0,0 +1,570 @@
<template>
<el-dialog
:title="!dataForm.id ? '新建' : '编辑'"
:close-on-click-modal="false"
append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="1000px"
>
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12">
<jnpf-form-tip-item label="倒班类型" prop="chgClassType">
<JnpfSelect v-model="dataForm.chgClassType" placeholder="请选择倒班类型" clearable :options="chgClassTypeOptions" :props="chgClassTypeProps" > </JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>班次明细</h2>
</div>
<el-table :data="dataForm.shiftConfigEntityList" size="mini">
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="班组" prop="classGroup" align="center">
<template slot-scope="scope">
<JnpfSelect v-model="scope.row.classGroup" placeholder="请选择" clearable :options="classGroupOptions" :props="classGroupProps"> </JnpfSelect>
</template>
</el-table-column>
<el-table-column label="班次" prop="classRate" align="center">
<template slot-scope="scope">
<JnpfSelect v-model="scope.row.classRate" placeholder="请选择" clearable :options="classRateOptions" :props="classRateProps"> </JnpfSelect>
</template>
</el-table-column>
<el-table-column label="开始时间" prop="bgnDtime" align="center">
<template slot-scope="scope">
<JnpfTimePicker v-model="scope.row.bgnDtime"
:startTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择开始时间" clearable
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker>
</template>
</el-table-column>
<el-table-column label="结束时间" prop="endDtime" align="center">
<template slot-scope="scope">
<JnpfTimePicker v-model="scope.row.endDtime"
:startTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择结束时间" clearable
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker>
</template>
</el-table-column>
<el-table-column label="序列号" prop="seqNo" align="center">
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.seqNo"
placeholder="请输入"
clearable
min="0"
type="number"
:style="{ width: '100%' }"
>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn" @click="delShiftConfigEntityList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addShiftConfigEntityList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
<el-button @click="visible = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from 'vuex'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from '@/components/Generator/utils/index'
import { getFieldDataSelect } from '@/api/onlineDev/visualDev'
export default {
components: {},
props: [],
data() {
return {
selectedData: [],
selectedIds: [],
list: [],
innerValue: '',
listQuery: {
keyword: '',
currentPage: 1,
pageSize: 20,
},
total: 0,
checked: '',
checkedTxt: '',
checkedRow: {},
listLoading: false,
inputHovering: false,
itemVisible: false,
detailVisible: false,
multiple: true,
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: {
qa_scheme_base_twList: {
popupType: 'dialog',
hasPage: true,
popupTitle: '选择数据',
pageSize: 20,
columnOptions: [],
interfaceId: '',
interfaceName: '',
relationOptions: [],
templateJson: [],
popupWidth: '800px',
},
},
//
ableAll: {},
tableRows: {
qa_scheme_base_twList: {
itemId: '',
itemIdOptions: [],
unit: '',
unitOptions: [],
standardValue: '',
standardValueOptions: [],
upperLimit: '',
upperLimitOptions: [],
lowerLimit: '',
lowerLimitOptions: [],
remark: '',
remarkOptions: [],
enabledmark: undefined,
},
},
Vmodel: '',
currVmodel: '',
dataForm: {
chgClassType: undefined,
shiftConfigEntityList: []
},
chgClassTypeOptions: [
{ fullName: '四班三倒', id: '1' },
{ fullName: '三班两到', id: '2' },
],
chgClassTypeProps: { label: 'fullName', value: 'id' },
classGroupOptions: [
{ fullName: '甲', id: '甲' },
{ fullName: '乙', id: '乙' },
{ fullName: '丙', id: '丙' },
{ fullName: '丁', id: '丁' },
],
classGroupProps: { label: 'fullName', value: 'id' },
classRateOptions: [
{ fullName: '白', id: '1' },
{ fullName: '中', id: '2' },
{ fullName: '夜', id: '3' },
],
classRateProps: { label: 'fullName', value: 'id' },
tableRequiredData: {},
dataRule: {
chgClassType: [
{
required: true,
message: '请选择倒班类型',
trigger: 'change',
},
],
},
childIndex: -1,
isEdit: false,
interfaceRes: {
schemeNo: [],
schemeName: [],
schemeType: [],
remark: [],
creatorUserId: [],
creatorTime: [],
qa_scheme_base_twitemId: [],
qa_scheme_base_twunit: [],
qa_scheme_base_twstandardValue: [],
qa_scheme_base_twupperLimit: [],
qa_scheme_base_twlowerLimit: [],
qa_scheme_base_twremark: [],
},
}
},
computed: {
...mapGetters(['userInfo']),
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
this.initData()
},
mounted() {},
methods: {
search() {
this.listQuery.currentPage = 1
this.listQuery.pageSize = this.pageSize
this.initData()
},
reset() {
this.listQuery.keyword = ''
this.listQuery.currentPage = 1
this.listQuery.pageSize = this.pageSize
this.initData()
},
select() {
let newArr = this.selectedData.filter(o => {
return this.dataForm.qa_scheme_base_twList.every(item => {
return o.id !== item.itemId
})
})
newArr.forEach(o => {
let item = {
itemId: o.id,
itemName:o.itemName,
unit: o.unitName,
standardValue: undefined,
upperLimit: undefined,
lowerLimit: undefined,
remark: undefined,
printMergeYn:"N",
printItem:undefined,
}
this.getqa_scheme_base_twList(item)
})
this.initDefaultData()
this.itemVisible = false
},
rowClick(row) {
this.checked = row.id
this.checkedTxt = row[this.relationField]
this.checkedRow = row
},
prev() {
this.initDefaultData()
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.initDefaultData()
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)
}
}
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
dataAll() {
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/example/Qa_scheme_base/' + this.dataForm.id,
method: 'get',
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
} else {
this.clearData()
this.initDefaultData()
}
})
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate(valid => {
if (valid) {
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/example/shiftConfig',
method: 'post',
data: _data,
})
.then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
},
})
})
.catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
} else {
request({
url: '/api/example/Qa_scheme_base/' + 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
})
}
console.log('########## >>>> ' + this.visible)
},
delShiftConfigEntityList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning',
})
.then(() => {
this.dataForm.shiftConfigEntityList.splice(index, 1)
})
.catch(() => {
})
},
addShiftConfigEntityList() {
let item = {
classGroup: undefined,
classRate: undefined,
bgnDtime: undefined,
endDtime: undefined,
seqNo: undefined
}
this.dataForm.shiftConfigEntityList.push(item)
},
getqa_scheme_base_twList(value) {
let item = { ...this.tableRows.qa_scheme_base_twList, ...value }
this.dataForm.qa_scheme_base_twList.push(item)
this.childIndex = this.dataForm.qa_scheme_base_twList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = ''
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = ''
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = ''
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = ''
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue
},
dataList() {
var _data = this.dataForm
return _data
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for (let i = 0; i < _dataAll.qa_scheme_base_twList.length; i++) {
this.childIndex = i
this.selectedIds.push(_dataAll.qa_scheme_base_twList[i].itemId)
}
this.childIndex = -1
},
},
}
</script>

View File

@ -0,0 +1,423 @@
<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.chgClassType" placeholder="请选择倒班类型" clearable :options="options" :props="props"> </JnpfSelect>
</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-button type="danger" icon="icon-ym icon-ym-btn-clearn" @click="handleDel(query.chgClassType)">删除</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新增 </el-button>
</div>
<div class="JNPF-common-head-right">
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change="sortChange" :span-method="arraySpanMethod" border>
<el-table-column prop="classGroup" label="班组" align="center"> </el-table-column>
<el-table-column prop="classRate" label="班次" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.classRate == '1'"></el-tag>
<el-tag v-else-if="scope.row.classRate == '2'"></el-tag>
<el-tag v-else-if="scope.row.classRate == '3'"></el-tag>
</template>
</el-table-column>
<el-table-column prop="chgClassType" label="倒班类型" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.chgClassType == '1'">四班三倒</el-tag>
<el-tag v-else-if="scope.row.chgClassType == '2'">三班两到</el-tag>
</template>
</el-table-column>
<el-table-column prop="bgnDtime" label="开始时间" align="center">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.bgnDtime) }}</span>
</template>
</el-table-column>
<el-table-column prop="endDtime" label="结束时间" align="center">
<template slot-scope="scope">
<span>{{ formatTime(scope.row.endDtime) }}</span>
</template>
</el-table-column>
<el-table-column prop="seqNo" label="序列号" align="center"> </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 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 columnList from './columnList'
import SuperQuery from '@/components/SuperQuery'
import superQueryJson from './superQueryJson'
export default {
name: 'shiftConfig',
components: {
JNPFForm,
Detail,
ExportBox,
ToFormDetail,
SuperQuery,
},
data() {
return {
itemCenterDialog: false,
dataForm: {
schemeName: '',
schemeNo: '',
},
dataRule: {},
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
options: [
{ fullName: '四班三倒', id: '1' },
{ fullName: '三班两到', id: '2' },
],
props: { label: 'fullName', value: 'id' },
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
chgClassType: undefined,
schemeNo: undefined
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf',
},
list: [],
listLoading: false,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: '',
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
interfaceRes: {},
}
},
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)
})
})
},
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: '617404338293179269',
type: 1,
}
request({
url: `/api/example/shiftConfig/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(chgClassType) {
if (chgClassType){
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning',
})
.then(() => {
request({
url: `/api/example/shiftConfig/${chgClassType}`,
method: 'DELETE',
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
},
})
})
})
.catch(() => {})
}
},
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)
})
},
copy(row) {
this.itemCenterDialog = true
this.dataForm = JSON.parse(JSON.stringify(row))
this.dataForm.schemeName = ''
this.dataForm.schemeNo = ''
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = { ...data, ...this.listQuery, ...this.query, menuId: this.menuId }
request({
url: `/api/example/Qa_scheme_base/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.search()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
formatTime(time) {
if (!time) return ''
return time.substring(0, 5)
},
},
}
</script>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,198 @@
<template>
<el-dialog title="详情"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="1000px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
<template v-if="!loading">
<el-col :span="12" >
<jnpf-form-tip-item label="编号"
prop="schemeNo" >
<p>{{dataForm.schemeNo}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="名称"
prop="schemeName" >
<p>{{dataForm.schemeName}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="适用类型"
prop="schemeType" >
<p>{{dataForm.schemeType==1?"原材料":dataForm.schemeType==2?"半成品":"成品"}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="产品大类"
prop="tiemClass" >
<p>{{dataForm.tiemClass}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="表单编号"
prop="formCode" >
<p>{{dataForm.formCode}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="执行标准"
prop="execStandard" >
<p>{{dataForm.execStandard}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="属性检测"
prop="isAttDet" >
<p>{{dataForm.isAttDet=='Y'?"是":"否"}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="描述"
prop="remark" >
<p>{{dataForm.remark}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="创建人"
prop="creatorUserId" >
<p>{{dataForm.creatorUserId}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="12" >
<jnpf-form-tip-item label="创建时间"
prop="creatorTime" >
<p>{{dataForm.creatorTime}}</p>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.tableField114" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column prop="itemId" label="检验项目" >
<template slot-scope="scope">
<el-link :underline="false" type="primary"
@click.native="toDetail(scope.row.itemId_id,'608540150753923141')">
{{scope.row.itemId}}</el-link>
</template>
</el-table-column>
<el-table-column prop="unit" label="单位" >
<template slot-scope="scope">
<p>{{scope.row.unit}}</p>
</template>
</el-table-column>
<el-table-column prop="standardValue" label="标准值" >
<template slot-scope="scope">
<p>{{scope.row.standardValue}}</p>
</template>
</el-table-column>
<el-table-column prop="upperLimit" label="上限值" >
<template slot-scope="scope">
<p>{{scope.row.upperLimit}}</p>
</template>
</el-table-column>
<el-table-column prop="lowerLimit" label="下限值" >
<template slot-scope="scope">
<p>{{scope.row.lowerLimit}}</p>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" >
<template slot-scope="scope">
<p>{{scope.row.remark}}</p>
</template>
</el-table-column>
<el-table-column prop="seqNo" label="展示顺序" >
<template slot-scope="scope">
<p>{{scope.row.seqNo}}</p>
</template>
</el-table-column>
</el-table>
</jnpf-form-tip-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
<Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getConfigData } from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
components: { Detail},
props: [],
data() {
return {
visible: false,
detailVisible: false,
loading: false,
dataForm: {
id :'',
schemeNo : '',
schemeName : '',
schemeType : '',
remark : '',
creatorUserId : "",
creatorTime : "",
qa_scheme_base_twList:[],
},
}
},
computed: {},
watch: {},
created() {
},
mounted() {},
methods: {
toDetail(defaultValue, modelId) {
if (!defaultValue) return
getConfigData(modelId).then(res => {
if (!res.data || !res.data.formData) return
let formData = JSON.parse(res.data.formData)
formData.popupType = 'general'
this.detailVisible = true
this.$nextTick(() => {
this.$refs.Detail.init(formData, modelId, defaultValue)
})
})
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
},
init(id) {
this.dataForm.id = id || 0;
this.visible = true;
this.$nextTick(() => {
if(this.dataForm.id){
this.loading = true
request({
url: '/api/example/Qa_scheme_base/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

View File

@ -0,0 +1,570 @@
<template>
<el-dialog
:title="!dataForm.id ? '新建' : '编辑'"
:close-on-click-modal="false"
append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="1000px"
>
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="120px" label-position="right" >
<template v-if="!loading">
<!-- 具体表单 -->
<el-col :span="12">
<jnpf-form-tip-item label="倒班类型" prop="chgClassType">
<JnpfSelect v-model="dataForm.chgClassType" placeholder="请选择倒班类型" clearable :options="chgClassTypeOptions" :props="chgClassTypeProps" > </JnpfSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>班次明细</h2>
</div>
<el-table :data="dataForm.shiftConfigEntityList" size="mini">
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="班组" prop="classGroup" align="center">
<template slot-scope="scope">
<JnpfSelect v-model="scope.row.classGroup" placeholder="请选择" clearable :options="classGroupOptions" :props="classGroupProps"> </JnpfSelect>
</template>
</el-table-column>
<el-table-column label="班次" prop="classRate" align="center">
<template slot-scope="scope">
<JnpfSelect v-model="scope.row.classRate" placeholder="请选择" clearable :options="classRateOptions" :props="classRateProps"> </JnpfSelect>
</template>
</el-table-column>
<el-table-column label="开始时间" prop="bgnDtime" align="center">
<template slot-scope="scope">
<JnpfTimePicker v-model="scope.row.bgnDtime"
:startTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择开始时间" clearable
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker>
</template>
</el-table-column>
<el-table-column label="结束时间" prop="endDtime" align="center">
<template slot-scope="scope">
<JnpfTimePicker v-model="scope.row.endDtime"
:startTime="time(false, 1, 1, '', 'HH:mm', '')"
:endTime="time(false, 1, 1, '', 'HH:mm', '')" placeholder="请选择结束时间" clearable
:style='{ "width": "100%" }' format="HH:mm">
</JnpfTimePicker>
</template>
</el-table-column>
<el-table-column label="序列号" prop="seqNo" align="center">
<template slot-scope="scope">
<JnpfInput
v-model="scope.row.seqNo"
placeholder="请输入"
clearable
min="0"
type="number"
:style="{ width: '100%' }"
>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn" @click="delShiftConfigEntityList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addShiftConfigEntityList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button>
<el-button @click="visible = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from 'vuex'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from '@/components/Generator/utils/index'
import { getFieldDataSelect } from '@/api/onlineDev/visualDev'
export default {
components: {},
props: [],
data() {
return {
selectedData: [],
selectedIds: [],
list: [],
innerValue: '',
listQuery: {
keyword: '',
currentPage: 1,
pageSize: 20,
},
total: 0,
checked: '',
checkedTxt: '',
checkedRow: {},
listLoading: false,
inputHovering: false,
itemVisible: false,
detailVisible: false,
multiple: true,
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: {
qa_scheme_base_twList: {
popupType: 'dialog',
hasPage: true,
popupTitle: '选择数据',
pageSize: 20,
columnOptions: [],
interfaceId: '',
interfaceName: '',
relationOptions: [],
templateJson: [],
popupWidth: '800px',
},
},
//
ableAll: {},
tableRows: {
qa_scheme_base_twList: {
itemId: '',
itemIdOptions: [],
unit: '',
unitOptions: [],
standardValue: '',
standardValueOptions: [],
upperLimit: '',
upperLimitOptions: [],
lowerLimit: '',
lowerLimitOptions: [],
remark: '',
remarkOptions: [],
enabledmark: undefined,
},
},
Vmodel: '',
currVmodel: '',
dataForm: {
chgClassType: undefined,
shiftConfigEntityList: []
},
chgClassTypeOptions: [
{ fullName: '四班三倒', id: '1' },
{ fullName: '三班两到', id: '2' },
],
chgClassTypeProps: { label: 'fullName', value: 'id' },
classGroupOptions: [
{ fullName: '甲', id: '甲' },
{ fullName: '乙', id: '乙' },
{ fullName: '丙', id: '丙' },
{ fullName: '丁', id: '丁' },
],
classGroupProps: { label: 'fullName', value: 'id' },
classRateOptions: [
{ fullName: '白', id: '1' },
{ fullName: '中', id: '2' },
{ fullName: '夜', id: '3' },
],
classRateProps: { label: 'fullName', value: 'id' },
tableRequiredData: {},
dataRule: {
chgClassType: [
{
required: true,
message: '请选择倒班类型',
trigger: 'change',
},
],
},
childIndex: -1,
isEdit: false,
interfaceRes: {
schemeNo: [],
schemeName: [],
schemeType: [],
remark: [],
creatorUserId: [],
creatorTime: [],
qa_scheme_base_twitemId: [],
qa_scheme_base_twunit: [],
qa_scheme_base_twstandardValue: [],
qa_scheme_base_twupperLimit: [],
qa_scheme_base_twlowerLimit: [],
qa_scheme_base_twremark: [],
},
}
},
computed: {
...mapGetters(['userInfo']),
},
watch: {},
created() {
this.dataAll()
this.initDefaultData()
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
this.initData()
},
mounted() {},
methods: {
search() {
this.listQuery.currentPage = 1
this.listQuery.pageSize = this.pageSize
this.initData()
},
reset() {
this.listQuery.keyword = ''
this.listQuery.currentPage = 1
this.listQuery.pageSize = this.pageSize
this.initData()
},
select() {
let newArr = this.selectedData.filter(o => {
return this.dataForm.qa_scheme_base_twList.every(item => {
return o.id !== item.itemId
})
})
newArr.forEach(o => {
let item = {
itemId: o.id,
itemName:o.itemName,
unit: o.unitName,
standardValue: undefined,
upperLimit: undefined,
lowerLimit: undefined,
remark: undefined,
printMergeYn:"N",
printItem:undefined,
}
this.getqa_scheme_base_twList(item)
})
this.initDefaultData()
this.itemVisible = false
},
rowClick(row) {
this.checked = row.id
this.checkedTxt = row[this.relationField]
this.checkedRow = row
},
prev() {
this.initDefaultData()
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.initDefaultData()
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)
}
}
},
goBack() {
this.visible = false
this.$emit('refreshDataList', true)
},
dataAll() {
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
init(id, isDetail, allList) {
this.prevDis = false
this.nextDis = false
this.allList = allList || []
if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id)
if (this.index == 0) {
this.prevDis = true
}
if (this.index == this.allList.length - 1) {
this.nextDis = true
}
} else {
this.prevDis = true
this.nextDis = true
}
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/example/Qa_scheme_base/' + this.dataForm.id,
method: 'get',
}).then(res => {
this.dataInfo(res.data)
this.loading = false
})
} else {
this.clearData()
this.initDefaultData()
}
})
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
},
//
initDefaultData() {
},
//
dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0
this.$refs['formRef'].validate(valid => {
if (valid) {
this.request()
}
})
},
request() {
let _data = this.dataList()
if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true
} else {
this.btnLoading = true
}
if (!this.dataForm.id) {
request({
url: '/api/example/shiftConfig',
method: 'post',
data: _data,
})
.then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
if (this.dataFormSubmitType == 2) {
this.$nextTick(() => {
this.clearData()
this.initDefaultData()
})
this.continueBtnLoading = false
return
}
this.visible = false
this.btnLoading = false
this.$emit('refresh', true)
},
})
})
.catch(() => {
this.btnLoading = false
this.continueBtnLoading = false
})
} else {
request({
url: '/api/example/Qa_scheme_base/' + 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
})
}
console.log('########## >>>> ' + this.visible)
},
delShiftConfigEntityList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning',
})
.then(() => {
this.dataForm.shiftConfigEntityList.splice(index, 1)
})
.catch(() => {
})
},
addShiftConfigEntityList() {
let item = {
classGroup: undefined,
classRate: undefined,
bgnDtime: undefined,
endDtime: undefined,
seqNo: undefined
}
this.dataForm.shiftConfigEntityList.push(item)
},
getqa_scheme_base_twList(value) {
let item = { ...this.tableRows.qa_scheme_base_twList, ...value }
this.dataForm.qa_scheme_base_twList.push(item)
this.childIndex = this.dataForm.qa_scheme_base_twList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = ''
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = ''
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = ''
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = ''
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue
},
dataList() {
var _data = this.dataForm
return _data
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for (let i = 0; i < _dataAll.qa_scheme_base_twList.length; i++) {
this.childIndex = i
this.selectedIds.push(_dataAll.qa_scheme_base_twList[i].itemId)
}
this.childIndex = -1
},
},
}
</script>

View File

@ -0,0 +1,474 @@
<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="年月">
<JnpfDatePicker v-model="query.years" format="yyyy-MM" startPlaceholder="开始日期"
endPlaceholder="结束日期" clearable>
</JnpfDatePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="倒班类型">
<JnpfSelect v-model="query.chgClassType" placeholder="请选择倒班类型" clearable :options="options" :props="props"> </JnpfSelect>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="开始日期">
<JnpfDatePicker v-model="query.bgnDtime" format="yyyy-MM-dd" startPlaceholder="开始日期"
endPlaceholder="结束日期" :startTime="todayDate">
</JnpfDatePicker>
</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-button type="success" icon="icon-ym el-icon-data-line" @click="debouncedGenerated()" :loading="generatedLoading" :disabled="generatedLoading">生成排班结果 </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>
</div>
<div class="JNPF-common-head-right">
</div>
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change="sortChange" :span-method="arraySpanMethod" border>
<el-table-column prop="classGroup" label="班组" align="center"> </el-table-column>
<el-table-column prop="classRate" label="班次" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.classRate == '1'"></el-tag>
<el-tag v-else-if="scope.row.classRate == '2'"></el-tag>
<el-tag v-else-if="scope.row.classRate == '3'"></el-tag>
</template>
</el-table-column>
<el-table-column prop="bgnDtime" label="开始时间" align="center" :formatter="jnpf.tableDateFormat"/>
<el-table-column prop="endDtime" label="结束时间" align="center" :formatter="jnpf.tableDateFormat"/>
<el-table-column prop="shiftHour" label="小时数" align="center"> </el-table-column>
<el-table-column prop="month" label="排班月份" align="center" :formatter="jnpf.tableDateFormat4"/>
</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'
import jnpf from "@/utils/jnpf";
import { debounce } from '@/utils'
export default {
name: 'shiftResult',
components: {
JNPFForm,
Detail,
ExportBox,
ToFormDetail,
SuperQuery,
},
data() {
return {
itemCenterDialog: false,
dataForm: {
schemeName: '',
schemeNo: '',
},
dataRule: {},
keyword: '',
expandsTree: true,
refreshTree: true,
toFormDetailVisible: false,
expandObj: {},
columnOptions: [],
mergeList: [],
exportList: [],
columnList,
options: [
{ fullName: '四班三倒', id: '1' },
{ fullName: '三班两到', id: '2' },
],
props: { label: 'fullName', value: 'id' },
pickerOptions: {
disabledDate(time) {
return time.getTime() < new Date().setHours(0, 0, 0, 0)
}
},
superQueryVisible: false,
superQueryJson,
uploadBoxVisible: false,
detailVisible: false,
query: {
chgClassType: undefined,
schemeNo: undefined,
bgnDtime:undefined
},
treeProps: {
children: 'children',
label: 'fullName',
value: 'id',
isLeaf: 'isLeaf',
},
list: [],
listLoading: false,
total: 0,
queryData: {},
listQuery: {
superQueryJson: '',
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: '',
},
formVisible: false,
flowVisible: false,
flowListVisible: false,
flowList: [],
exportBoxVisible: false,
interfaceRes: {},
debouncedGenerated: null,
generatedLoading: false,
}
},
computed: {
jnpf() {
return jnpf
},
...mapGetters(['userInfo']),
menuId() {
return this.$route.meta.modelId || ''
},
todayDate() {
const today = new Date()
const year = today.getFullYear()
const month = String(today.getMonth() + 1).padStart(2, '0')
const day = String(today.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
},
},
created() {
this.debouncedGenerated = debounce(this.generated, 1000)
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)
})
})
},
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() {
const now = new Date();
this.query.years= new Date(now.getFullYear(), now.getMonth(), 1).getTime();
this.query.bgnDtime=new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
},
generated() {
if (this.generatedLoading) return
this.generatedLoading = true
let _data = {
...this.query,
}
request({
url: '/api/example/shiftResult',
method: 'post',
data: _data,
})
.then(res => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.initData()
},
})
})
.catch(() => {
})
.finally(() => {
this.generatedLoading = false
})
},
initData() {
this.listLoading = true
let _query = {
...this.listQuery,
...this.query,
keyword: this.keyword,
dataType: 0,
menuId: this.menuId,
moduleId: '617404338293179269',
type: 1,
}
request({
url: `/api/example/shiftResult/getList`,
method: 'post',
data: _query,
}).then(res => {
var _list = res.data.list
this.list = _list.map(o => ({
...o,
...this.expandObj,
}))
this.total = res.data.pagination.total
this.listLoading = false
})
},
handleDel(id) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning',
})
.then(() => {
request({
url: `/api/example/shiftConfig/${id}`,
method: 'DELETE',
}).then(res => {
this.$message({
type: 'success',
message: res.msg,
onClose: () => {
this.initData()
},
})
})
})
.catch(() => {})
},
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)
})
},
copy(row) {
this.itemCenterDialog = true
this.dataForm = JSON.parse(JSON.stringify(row))
this.dataForm.schemeName = ''
this.dataForm.schemeNo = ''
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
this.$refs.ExportBox.init(this.exportList)
})
},
download(data) {
let query = { ...data, ...this.listQuery, ...this.query, menuId: this.menuId }
request({
url: `/api/example/Qa_scheme_base/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.search()
},
reset() {
this.query = JSON.parse(JSON.stringify(this.queryData))
this.search()
},
formatTime(time) {
if (!time) return ''
return time.substring(0, 5)
},
},
}
</script>

File diff suppressed because one or more lines are too long

View File

@ -172,6 +172,9 @@ public class FlowJsonUtil {
boolean flag = false;
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("js");
if (scriptEngine == null) {
return false;
}
Map<String, Object> map = JsonUtil.stringToMap(data);
List<String> expressionAll = new ArrayList<>();
StringBuilder condition = new StringBuilder();
@ -448,6 +451,9 @@ public class FlowJsonUtil {
String field = field(properCond.getField(), data, null);
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("js");
if (scriptEngine == null) {
return null;
}
String eval = builder.toString() + " var result = " + field + ";";
scriptEngine.eval(eval);
double d = (double) scriptEngine.get("result");