Merge branch 'master' of http://121.40.234.130:8899/root/lanzhouhailiang_one
This commit is contained in:
@@ -361,6 +361,18 @@
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.nl.modules.tools.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -97,4 +98,12 @@ public class LocalStorageController {
|
||||
localStorageService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导入数据")
|
||||
@PostMapping("/importExcel")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> importExcel(@RequestBody String path) {
|
||||
localStorageService.importExcel(path);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,10 @@ public interface LocalStorageService {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<LocalStorageDto> localStorageDtos, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param path
|
||||
*/
|
||||
void importExcel(String path);
|
||||
}
|
||||
@@ -15,21 +15,23 @@
|
||||
*/
|
||||
package org.nl.modules.tools.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.config.FileProperties;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.tools.domain.LocalStorage;
|
||||
import org.nl.modules.tools.repository.LocalStorageRepository;
|
||||
import org.nl.modules.tools.service.LocalStorageService;
|
||||
import org.nl.modules.tools.service.dto.LocalStorageDto;
|
||||
import org.nl.modules.tools.service.dto.LocalStorageQueryCriteria;
|
||||
import org.nl.modules.tools.service.mapstruct.LocalStorageMapper;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -135,4 +137,43 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String path) {
|
||||
WQLObject measureunitTab = WQLObject.getWQLObject("md_pb_measureunit");
|
||||
WQLObject materialbaseTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
|
||||
// listMap.remove(0);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
String material_code = String.valueOf(map.get(5));
|
||||
String material_name = String.valueOf(map.get(6));
|
||||
String unit_code = String.valueOf(map.get(7));
|
||||
JSONObject object = measureunitTab.query("unit_code = '" + unit_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(object)) throw new BadRequestException("空" + unit_code);
|
||||
JSONObject material = new JSONObject();
|
||||
material.put("material_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
material.put("material_code", material_code);
|
||||
material.put("material_name", material_name);
|
||||
material.put("base_unit_id", object.getString("measure_unit_id"));
|
||||
material.put("is_used", 1);
|
||||
material.put("is_delete", 0);
|
||||
material.put("create_id", currentUserId);
|
||||
material.put("create_name", nickName);
|
||||
material.put("create_time", now);
|
||||
material.put("update_optid", currentUserId);
|
||||
material.put("update_optname", nickName);
|
||||
material.put("update_time", now);
|
||||
materialbaseTab.insert(material);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.rest;
|
||||
|
||||
|
||||
import org.nl.wms.pdm.bi.service.SubpackagerelationService;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "子卷包装关系管理")
|
||||
@RequestMapping("/api/subpackagerelation")
|
||||
@Slf4j
|
||||
public class SubpackagerelationController {
|
||||
|
||||
private final SubpackagerelationService subpackagerelationService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询子卷包装关系")
|
||||
@ApiOperation("查询子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(subpackagerelationService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增子卷包装关系")
|
||||
@ApiOperation("新增子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody SubpackagerelationDto dto){
|
||||
subpackagerelationService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改子卷包装关系")
|
||||
@ApiOperation("修改子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody SubpackagerelationDto dto){
|
||||
subpackagerelationService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除子卷包装关系")
|
||||
@ApiOperation("删除子卷包装关系")
|
||||
//@SaCheckPermission("@el.check('subpackagerelation:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
subpackagerelationService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.service;
|
||||
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
public interface SubpackagerelationService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<SubpackagerelationDto>
|
||||
*/
|
||||
List<SubpackagerelationDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param workorder_id ID
|
||||
* @return Subpackagerelation
|
||||
*/
|
||||
SubpackagerelationDto findById(Long workorder_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Subpackagerelation
|
||||
*/
|
||||
SubpackagerelationDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto /
|
||||
*/
|
||||
void create(SubpackagerelationDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(SubpackagerelationDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.wms.pdm.bi.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@Data
|
||||
public class SubpackagerelationDto implements Serializable {
|
||||
|
||||
/** 子卷包装标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long workorder_id;
|
||||
|
||||
/** 木箱唯一码 */
|
||||
private String package_box_SN;
|
||||
|
||||
/** 箱内子卷数量 */
|
||||
private BigDecimal quanlity_in_box;
|
||||
|
||||
/** 木箱自身重量 */
|
||||
private BigDecimal box_weight;
|
||||
|
||||
/** 保质期 */
|
||||
private BigDecimal quality_guaran_period;
|
||||
|
||||
/** 销售订单及行号 */
|
||||
private String sale_order_name;
|
||||
|
||||
/** 客户编号 */
|
||||
private String customer_name;
|
||||
|
||||
/** 客户名称 */
|
||||
private String customer_description;
|
||||
|
||||
/** 产品编码 */
|
||||
private String product_name;
|
||||
|
||||
/** 产品描述 */
|
||||
private String product_description;
|
||||
|
||||
/** 入库日期 */
|
||||
private String date_of_FG_inbound;
|
||||
|
||||
/** 子卷号 */
|
||||
private String container_name;
|
||||
|
||||
/** 产品规格(幅宽) */
|
||||
private String width;
|
||||
|
||||
/** 产品厚度 */
|
||||
private String thickness;
|
||||
|
||||
/** 单位面积质量 */
|
||||
private BigDecimal mass_per_unit_area;
|
||||
|
||||
/** 净重 */
|
||||
private BigDecimal net_weight;
|
||||
|
||||
/** 长度 */
|
||||
private BigDecimal length;
|
||||
|
||||
/** 制造完成日期 */
|
||||
private String date_of_production;
|
||||
|
||||
/** 计划外分切的子卷 */
|
||||
private String is_un_plan_production;
|
||||
|
||||
/** 子卷的物性值1 */
|
||||
private String un_plan_product_property1;
|
||||
|
||||
/** 子卷的物性值2 */
|
||||
private String un_plan_product_property2;
|
||||
|
||||
/** 子卷的物性值3 */
|
||||
private String un_plan_product_property3;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
|
||||
/** 状态 */
|
||||
private String status;
|
||||
|
||||
/** 是否需要重打外包装标签 */
|
||||
private String isRePrintPackageBoxLabel;
|
||||
|
||||
/** 是否需要拆包重打子卷标签 */
|
||||
private String isUnPackBox;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
package org.nl.wms.pdm.bi.service.impl;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.pdm.bi.service.SubpackagerelationService;
|
||||
import org.nl.wms.pdm.bi.service.dto.SubpackagerelationDto;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @description 服务实现
|
||||
* @author lyd
|
||||
* @date 2022-10-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SubpackagerelationServiceImpl implements SubpackagerelationService {
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(Map whereJson, Pageable page){
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "1=1", "package_box_SN desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SubpackagerelationDto> queryAll(Map whereJson){
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(SubpackagerelationDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubpackagerelationDto findById(Long workorder_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( SubpackagerelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubpackagerelationDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)){
|
||||
return json.toJavaObject( SubpackagerelationDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(SubpackagerelationDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(SubpackagerelationDto dto) {
|
||||
SubpackagerelationDto entity = this.findById(dto.getWorkorder_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_subpackagerelation");
|
||||
for (Long workorder_id: ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("workorder_id", String.valueOf(workorder_id));
|
||||
param.put("is_delete", "1");
|
||||
// param.put("update_optid", currentUserId);
|
||||
// param.put("update_optname", nickName);
|
||||
// param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -80,15 +80,15 @@
|
||||
<#list columns as column>
|
||||
<#if column.columnShow>
|
||||
<#if (column.dictName)?? && (column.dictName)!="">
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<#elseif column.columnType != 'Timestamp'>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" />
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')"/>
|
||||
<#else>
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>">
|
||||
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.${column.changeColumnName}) }}</span>
|
||||
</template>
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
"screenfull": "4.2.0",
|
||||
"sortablejs": "1.8.4",
|
||||
"throttle-debounce": "^5.0.0",
|
||||
"v-fit-columns": "^0.2.0",
|
||||
"vue": "2.6.10",
|
||||
"vue-color": "^2.8.1",
|
||||
"vue-count-to": "1.0.13",
|
||||
|
||||
@@ -42,7 +42,7 @@ import '@logicflow/extension/lib/style/index.css'
|
||||
import Tinymce from '@/views/system/build/tinymce/index.vue'
|
||||
import request from '@/utils/request' // 实现 form generator 使用自己定义的 axios request 对象
|
||||
|
||||
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels } from '@/utils/nladmin'
|
||||
import { addDateRange, handleTree, parseTime, resetForm, selectDictLabel, selectDictLabels, flexWidth } from '@/utils/nladmin'
|
||||
|
||||
import { getValueByCode } from '@/api/system/param'
|
||||
|
||||
@@ -59,6 +59,10 @@ Vue.prototype.selectDictLabel = selectDictLabel
|
||||
Vue.prototype.selectDictLabels = selectDictLabels
|
||||
Vue.prototype.handleTree = handleTree
|
||||
Vue.prototype.getValueByCode = getValueByCode
|
||||
Vue.prototype.flexWidth = flexWidth
|
||||
|
||||
import Plugin from 'v-fit-columns'
|
||||
Vue.use(Plugin)
|
||||
|
||||
Vue.use(scroll)
|
||||
|
||||
|
||||
@@ -222,3 +222,45 @@ export async function blobValidate(data) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动列宽
|
||||
* flexWidth: https://blog.csdn.net/luoyumeiluoyumei/article/details/125853152?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-125853152-blog-123421632.pc_relevant_recovery_v2&spm=1001.2101.3001.4242.2&utm_relevant_index=4
|
||||
* @param prop 每列的prop 不能为空
|
||||
* @param tableData 表格数据
|
||||
* @param title 标题长内容短的,传标题 不能为空
|
||||
* @param num 列中有标签等加的富余量
|
||||
* @returns 列的宽度
|
||||
* 注:prop,title有一个必传
|
||||
*/
|
||||
export function flexWidth(prop, tableData, title, num = 0) {
|
||||
if (tableData.length === 0) { // 表格没数据不做处理
|
||||
return
|
||||
}
|
||||
let flexWidth = 0// 初始化表格列宽
|
||||
let columnContent = ''// 占位最宽的内容
|
||||
const canvas = document.createElement('canvas')
|
||||
const context = canvas.getContext('2d')
|
||||
context.font = '14px Microsoft YaHei'
|
||||
// 获取占位最宽的内容
|
||||
let index = 0
|
||||
for (let i = 0; i < tableData.length; i++) { // 循环表格内容,获取表格内容中最长的数据
|
||||
const now_temp = tableData[i][prop] + ''
|
||||
const max_temp = tableData[index][prop] + ''
|
||||
const now_temp_w = context.measureText(now_temp).width
|
||||
const max_temp_w = context.measureText(max_temp).width
|
||||
if (now_temp_w > max_temp_w) {
|
||||
index = i
|
||||
}
|
||||
}
|
||||
columnContent = tableData[index][prop]
|
||||
const column_w = context.measureText(columnContent).width
|
||||
const title_w = context.measureText(title).width
|
||||
if (column_w < title_w) {
|
||||
columnContent = title || '留四个字'
|
||||
}
|
||||
// 计算最宽内容的列宽
|
||||
const width = context.measureText(columnContent)
|
||||
flexWidth = width.width + 20 + num
|
||||
return flexWidth + 'px'
|
||||
}
|
||||
|
||||
214
lms/nladmin-ui/src/views/wms/pdm/bi/index.vue
Normal file
214
lms/nladmin-ui/src/views/wms/pdm/bi/index.vue
Normal file
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-form-item label="木箱唯一码">
|
||||
<el-input v-model="form.package_box_SN" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="箱内子卷数量">
|
||||
<el-input v-model="form.quanlity_in_box" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="木箱自身重量">
|
||||
<el-input v-model="form.box_weight" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保质期">
|
||||
<el-input v-model="form.quality_guaran_period" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="销售订单及行号">
|
||||
<el-input v-model="form.sale_order_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户名称" prop="customer_description">
|
||||
<el-input v-model="form.customer_description" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品编码" prop="product_name">
|
||||
<el-input v-model="form.product_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品描述" prop="product_description">
|
||||
<el-input v-model="form.product_description" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库日期">
|
||||
<el-input v-model="form.date_of_FG_inbound" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="子卷号" prop="container_name">
|
||||
<el-input v-model="form.container_name" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品规格(幅宽)" prop="width">
|
||||
<el-input v-model="form.width" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品厚度" prop="thickness">
|
||||
<el-input v-model="form.thickness" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位面积质量" prop="mass_per_unit_area">
|
||||
<el-input v-model="form.mass_per_unit_area" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="净重" prop="net_weight">
|
||||
<el-input v-model="form.net_weight" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="长度" prop="length">
|
||||
<el-input v-model="form.length" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="制造完成日期" prop="date_of_production">
|
||||
<el-input v-model="form.date_of_production" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划外分切的子卷" prop="is_un_plan_production">
|
||||
<el-input v-model="form.is_un_plan_production" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="子卷的物性值1">
|
||||
<el-input v-model="form.un_plan_product_property1" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="子卷的物性值2">
|
||||
<el-input v-model="form.un_plan_product_property2" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="子卷的物性值3">
|
||||
<el-input v-model="form.un_plan_product_property3" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-input v-model="form.status" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否需要重打外包装标签">
|
||||
<el-input v-model="form.isRePrintPackageBoxLabel" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否需要拆包重打子卷标签">
|
||||
<el-input v-model="form.isUnPackBox" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" style="width: 100%" :data="crud.data" size="mini" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" />
|
||||
<el-table-column prop="package_box_SN" label="木箱码" :width="flexWidth('package_box_SN',crud.data,'木箱码')" />
|
||||
<el-table-column prop="quanlity_in_box" label="箱内子卷数量" :width="flexWidth('quanlity_in_box',crud.data,'箱内子卷数量')" />
|
||||
<el-table-column prop="box_weight" label="木箱自身重量" :width="flexWidth('box_weight',crud.data,'木箱自身重量')" />
|
||||
<el-table-column prop="quality_guaran_period" label="保质期" :width="flexWidth('quality_guaran_period',crud.data,'保质期')"/>
|
||||
<el-table-column v-if="false" prop="sale_order_name" label="销售订单及行号" class-name="leave-alone"/>
|
||||
<el-table-column prop="customer_description" label="客户名称" :width="flexWidth('customer_description',crud.data,'客户名称')" />
|
||||
<el-table-column v-if="false" prop="product_name" label="产品编码" :width="flexWidth('product_name',crud.data,'产品编码')" />
|
||||
<el-table-column prop="product_description" label="产品描述" :width="flexWidth('product_description',crud.data,'产品描述')"/>
|
||||
<el-table-column prop="date_of_FG_inbound" label="入库日期" :width="flexWidth('date_of_FG_inbound',crud.data,'入库日期')" />
|
||||
<el-table-column prop="container_name" label="子卷号" :width="flexWidth('container_name',crud.data,'子卷号')" />
|
||||
<el-table-column prop="width" label="产品规格(幅宽)" :width="flexWidth('width',crud.data,'产品规格(幅宽)')" />
|
||||
<el-table-column prop="thickness" label="产品厚度" :width="flexWidth('thickness',crud.data,'产品厚度')" />
|
||||
<el-table-column prop="mass_per_unit_area" label="单位面积质量" :formatter="crud.formatNum3" :width="flexWidth('mass_per_unit_area',crud.data,'单位面积质量')" />
|
||||
<el-table-column prop="net_weight" label="净重" :formatter="crud.formatNum3" :width="flexWidth('net_weight',crud.data,'净重')" />
|
||||
<el-table-column prop="length" label="长度" :formatter="crud.formatNum3" :width="flexWidth('length',crud.data,'长度')" />
|
||||
<el-table-column prop="date_of_production" label="制造完成日期" :width="flexWidth('date_of_production',crud.data,'制造完成日期')" />
|
||||
<el-table-column prop="is_un_plan_production" label="计划外分切的子卷" :width="flexWidth('is_un_plan_production',crud.data,'计划外分切的子卷')" >
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.IS_OR_NOT[scope.row.is_un_plan_production] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="un_plan_product_property1" label="子卷的物性值1" :width="flexWidth('un_plan_product_property1',crud.data,'子卷的物性值1')" />
|
||||
<el-table-column prop="un_plan_product_property2" label="子卷的物性值2" :width="flexWidth('un_plan_product_property2',crud.data,'子卷的物性值2')" />
|
||||
<el-table-column prop="un_plan_product_property3" label="子卷的物性值3" :width="flexWidth('un_plan_product_property3',crud.data,'子卷的物性值3')" />
|
||||
<el-table-column prop="remark" label="备注" :width="flexWidth('remark',crud.data,'备注')" />
|
||||
<el-table-column prop="create_name" label="创建人" :width="flexWidth('create_name',crud.data,'创建人')" />
|
||||
<el-table-column prop="create_time" label="创建时间" :width="flexWidth('create_time',crud.data,'创建时间')" />
|
||||
<el-table-column prop="status" label="状态" :width="flexWidth('status',crud.data,'状态')" >
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.sub_package_relation[scope.row.status] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="isRePrintPackageBoxLabel" label="是否需要重打外包装标签" :width="flexWidth('isRePrintPackageBoxLabel',crud.data,'是否需要重打外包装标签')" />
|
||||
<el-table-column prop="isUnPackBox" label="是否需要拆包重打子卷标签" :width="flexWidth('isUnPackBox',crud.data,'是否需要拆包重打子卷标签')" />
|
||||
<el-table-column v-permission="[]" label="操作" align="center" fixed="right" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudSubpackagerelation from './subpackagerelation'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = { workorder_id: null, package_box_SN: null, quanlity_in_box: null, box_weight: null, quality_guaran_period: null, sale_order_name: null, customer_name: null, customer_description: null, product_name: null, product_description: null, date_of_FG_inbound: null, container_name: null, width: null, thickness: null, mass_per_unit_area: null, net_weight: null, length: null, date_of_production: null, is_un_plan_production: null, un_plan_product_property1: null, un_plan_product_property2: null, un_plan_product_property3: null, remark: null, create_id: null, create_name: null, create_time: null, status: null, isRePrintPackageBoxLabel: null, isUnPackBox: null }
|
||||
export default {
|
||||
name: 'Subpackagerelation',
|
||||
dicts: ['sub_package_relation', 'IS_OR_NOT'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '子卷包装关系', url: 'api/subpackagerelation', idField: 'workorder_id', sort: 'workorder_id,desc', crudMethod: { ...crudSubpackagerelation }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
customer_description: [
|
||||
{ required: true, message: '客户名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
product_name: [
|
||||
{ required: true, message: '产品编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
product_description: [
|
||||
{ required: true, message: '产品描述不能为空', trigger: 'blur' }
|
||||
],
|
||||
container_name: [
|
||||
{ required: true, message: '子卷号不能为空', trigger: 'blur' }
|
||||
],
|
||||
width: [
|
||||
{ required: true, message: '产品规格(幅宽)不能为空', trigger: 'blur' }
|
||||
],
|
||||
thickness: [
|
||||
{ required: true, message: '产品厚度不能为空', trigger: 'blur' }
|
||||
],
|
||||
mass_per_unit_area: [
|
||||
{ required: true, message: '单位面积质量不能为空', trigger: 'blur' }
|
||||
],
|
||||
net_weight: [
|
||||
{ required: true, message: '净重不能为空', trigger: 'blur' }
|
||||
],
|
||||
length: [
|
||||
{ required: true, message: '长度不能为空', trigger: 'blur' }
|
||||
],
|
||||
date_of_production: [
|
||||
{ required: true, message: '制造完成日期不能为空', trigger: 'blur' }
|
||||
],
|
||||
is_un_plan_production: [
|
||||
{ required: true, message: '计划外分切的子卷不能为空', trigger: 'blur' }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: '状态不能为空', trigger: 'blur' }
|
||||
]
|
||||
}}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tableAuto.el-table .cell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
27
lms/nladmin-ui/src/views/wms/pdm/bi/subpackagerelation.js
Normal file
27
lms/nladmin-ui/src/views/wms/pdm/bi/subpackagerelation.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/subpackagerelation',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/subpackagerelation/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/subpackagerelation',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del }
|
||||
Reference in New Issue
Block a user