磅单上传审核

product
17602169347 2 years ago
parent 185c75f727
commit bbd4981bc4

@ -479,29 +479,29 @@ public class TradeuploadController {
* @param tradeuploadPagination
* @return
*/
@PostMapping("/getList")
@PostMapping("/getList")
public ActionResult list(@RequestBody TradeuploadPagination tradeuploadPagination)throws IOException{
List<TradeuploadEntity> list= tradeuploadService.getList(tradeuploadPagination);
//处理id字段转名称若无需转或者为空可删除
for(TradeuploadEntity entity:list){
for(TradeuploadEntity entity:list){
entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
Map<String,Object> materialIdMap = new HashMap<>();
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
Map<String,Object> customerIdMap = new HashMap<>();
entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
Map<String,Object> salesIdMap = new HashMap<>();
entity.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",entity.getSalesId(),salesIdMap));
Map<String,Object> vehicleIdMap = new HashMap<>();
Map<String,Object> vehicleIdMap = new HashMap<>();
entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap));
entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
Map<String,Object> businessIdMap = new HashMap<>();
entity.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getBusinessId(),businessIdMap));
Map<String,Object> naturalIdMap = new HashMap<>();
entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap));
}
List<TradeuploadListVO> listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class);
for(TradeuploadListVO tradeuploadVO:listVO){
}
}
List<TradeuploadListVO> listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class);
for(TradeuploadListVO tradeuploadVO:listVO){
}
PageListVO vo=new PageListVO();
@ -535,15 +535,15 @@ public class TradeuploadController {
entity.setId(mainId);
tradeuploadService.save(entity);
return ActionResult.success("创建成功");
}
}
/**
*
*
* @return
*/
*
*
* @return
*/
@ApiOperation("模板下载")
@GetMapping("/templateDownload")
public ActionResult<DownloadVO> TemplateDownload(){
@ -558,10 +558,10 @@ public class TradeuploadController {
return ActionResult.success(vo);
}
/**
* Excel
*
* @return
*/
* Excel
*
* @return
*/
@ApiOperation("导出Excel")
@GetMapping("/Actions/Export")
public ActionResult Export(TradeuploadPaginationExportModel tradeuploadPaginationExportModel) throws IOException {
@ -571,25 +571,25 @@ public class TradeuploadController {
TradeuploadPagination tradeuploadPagination=JsonUtil.getJsonToBean(tradeuploadPaginationExportModel, TradeuploadPagination.class);
List<TradeuploadEntity> list= tradeuploadService.getTypeList(tradeuploadPagination,tradeuploadPaginationExportModel.getDataType());
//处理id字段转名称若无需转或者为空可删除
for(TradeuploadEntity entity:list){
for(TradeuploadEntity entity:list){
entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
Map<String,Object> materialIdMap = new HashMap<>();
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
Map<String,Object> customerIdMap = new HashMap<>();
entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
Map<String,Object> salesIdMap = new HashMap<>();
entity.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",entity.getSalesId(),salesIdMap));
Map<String,Object> vehicleIdMap = new HashMap<>();
Map<String,Object> vehicleIdMap = new HashMap<>();
entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap));
entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
Map<String,Object> businessIdMap = new HashMap<>();
entity.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getBusinessId(),businessIdMap));
Map<String,Object> naturalIdMap = new HashMap<>();
entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap));
}
List<TradeuploadListVO> listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class);
for(TradeuploadListVO tradeuploadVO:listVO){
}
}
List<TradeuploadListVO> listVO=JsonUtil.getJsonToList(list,TradeuploadListVO.class);
for(TradeuploadListVO tradeuploadVO:listVO){
}
//转换为map输出
List<Map<String, Object>>mapList=JsonUtil.getJsonToListMap(JsonUtil.getObjectToStringDateFormat(listVO,"yyyy-MM-dd HH:mm:ss"));
@ -601,96 +601,96 @@ public class TradeuploadController {
//导出表格
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "poundPictures" :
entitys.add(new ExcelExportEntity("磅单上传" ,"poundPictures"));
break;
entitys.add(new ExcelExportEntity("磅单上传" ,"poundPictures"));
break;
case "materialId" :
entitys.add(new ExcelExportEntity("物料名称" ,"materialId"));
break;
entitys.add(new ExcelExportEntity("物料名称" ,"materialId"));
break;
case "customerId" :
entitys.add(new ExcelExportEntity("客户名称" ,"customerId"));
break;
entitys.add(new ExcelExportEntity("客户名称" ,"customerId"));
break;
case "salesId" :
entitys.add(new ExcelExportEntity("销售合同" ,"salesId"));
break;
entitys.add(new ExcelExportEntity("销售合同" ,"salesId"));
break;
case "vehicleId" :
entitys.add(new ExcelExportEntity("车牌号" ,"vehicleId"));
break;
entitys.add(new ExcelExportEntity("车牌号" ,"vehicleId"));
break;
case "vehiclePictures" :
entitys.add(new ExcelExportEntity("车辆图片" ,"vehiclePictures"));
break;
entitys.add(new ExcelExportEntity("车辆图片" ,"vehiclePictures"));
break;
case "poundDate" :
entitys.add(new ExcelExportEntity("磅单时间" ,"poundDate"));
break;
entitys.add(new ExcelExportEntity("磅单时间" ,"poundDate"));
break;
case "poundlistNo" :
entitys.add(new ExcelExportEntity("磅单号" ,"poundlistNo"));
break;
entitys.add(new ExcelExportEntity("磅单号" ,"poundlistNo"));
break;
case "tareWeight" :
entitys.add(new ExcelExportEntity("皮重" ,"tareWeight"));
break;
entitys.add(new ExcelExportEntity("皮重" ,"tareWeight"));
break;
case "grossWeight" :
entitys.add(new ExcelExportEntity("毛重" ,"grossWeight"));
break;
entitys.add(new ExcelExportEntity("毛重" ,"grossWeight"));
break;
case "buckleWeight" :
entitys.add(new ExcelExportEntity("扣重" ,"buckleWeight"));
break;
entitys.add(new ExcelExportEntity("扣重" ,"buckleWeight"));
break;
case "netWeight" :
entitys.add(new ExcelExportEntity("净重" ,"netWeight"));
break;
entitys.add(new ExcelExportEntity("净重" ,"netWeight"));
break;
case "unit" :
entitys.add(new ExcelExportEntity("单位 " ,"unit"));
break;
entitys.add(new ExcelExportEntity("单位 " ,"unit"));
break;
case "transportType" :
entitys.add(new ExcelExportEntity("运输类型" ,"transportType"));
break;
entitys.add(new ExcelExportEntity("运输类型" ,"transportType"));
break;
case "advance" :
entitys.add(new ExcelExportEntity("是否垫资" ,"advance"));
break;
entitys.add(new ExcelExportEntity("是否垫资" ,"advance"));
break;
case "transportPrice" :
entitys.add(new ExcelExportEntity("运费" ,"transportPrice"));
break;
entitys.add(new ExcelExportEntity("运费" ,"transportPrice"));
break;
case "salesPrice" :
entitys.add(new ExcelExportEntity("销售价格" ,"salesPrice"));
break;
case "creatorUserName" :
entitys.add(new ExcelExportEntity("业务员" ,"creatorUserName"));
break;
entitys.add(new ExcelExportEntity("销售价格" ,"salesPrice"));
break;
case "businessId" :
entitys.add(new ExcelExportEntity("业务员" ,"businessId"));
break;
case "naturalId" :
entitys.add(new ExcelExportEntity("自然人" ,"naturalId"));
break;
entitys.add(new ExcelExportEntity("自然人" ,"naturalId"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "creatorTime" :
entitys.add(new ExcelExportEntity("磅单日期" ,"creatorTime"));
break;
default:
break;
}
entitys.add(new ExcelExportEntity("磅单日期" ,"creatorTime"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, list);
}
String name = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
String fileName = configValueUtil.getTemporaryFilePath() + name;
@Cleanup FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName));
workbook.write(output);
//上传文件
UploadUtil.uploadFile(configValueUtil.getFileType(), fileName, FileTypeEnum.TEMPORARY, name);
String fileName = configValueUtil.getTemporaryFilePath() + name;
@Cleanup FileOutputStream output = new FileOutputStream(XSSEscape.escapePath(fileName));
workbook.write(output);
//上传文件
UploadUtil.uploadFile(configValueUtil.getFileType(), fileName, FileTypeEnum.TEMPORARY, name);
vo.setName(name);
vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + name + "#" + "Temporary"));
vo.setName(name);
vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + name + "#" + "Temporary"));
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
@ -709,7 +709,7 @@ public class TradeuploadController {
@Transactional
public ActionResult batchRemove(@PathVariable("ids") String ids){
String[] idList = ids.split(",");
int i =0;
int i =0;
for (String allId : idList){
this.delete(allId);
i++;
@ -717,16 +717,16 @@ public class TradeuploadController {
if (i == 0 ){
return ActionResult.fail("删除失败");
}
return ActionResult.success("删除成功");
return ActionResult.success("删除成功");
}
/**
*
*
* @param id
* @return
*/
*
*
* @param id
* @return
*/
@GetMapping("/{id}")
public ActionResult<TradeuploadInfoVO> info(@PathVariable("id") String id){
TradeuploadEntity entity= tradeuploadService.getInfo(id);
@ -735,54 +735,54 @@ public class TradeuploadController {
vo.setCreatorTime(vo.getCreatorTime());
}
//子表
//副表
//子表
//副表
return ActionResult.success(vo);
}
/**
* ()
*
* @param id
* @return
*/
* ()
*
* @param id
* @return
*/
@GetMapping("/detail/{id}")
public ActionResult<TradeuploadInfoVO> detailInfo(@PathVariable("id") String id){
TradeuploadEntity entity= tradeuploadService.getInfo(id);
TradeuploadInfoVO vo=JsonUtil.getJsonToBean(entity, TradeuploadInfoVO.class);
//子表数据转换
//子表数据转换
//附表数据转换
//附表数据转换
//添加到详情表单对象中
vo.setPoundPictures(generaterSwapUtil.getFileNameInJson(vo.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",vo.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
vo.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",vo.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
vo.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",vo.getSalesId(),salesIdMap));
Map<String,Object> vehicleIdMap = new HashMap<>();
vo.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",vo.getVehicleId(),vehicleIdMap));
vo.setVehiclePictures(generaterSwapUtil.getFileNameInJson(vo.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
vo.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",vo.getBusinessId(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
vo.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",vo.getNaturalId(),naturalIdMap));
vo.setPoundPictures(generaterSwapUtil.getFileNameInJson(vo.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",vo.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
vo.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",vo.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
vo.setSalesId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","contract_name",vo.getSalesId(),salesIdMap));
Map<String,Object> vehicleIdMap = new HashMap<>();
vo.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",vo.getVehicleId(),vehicleIdMap));
vo.setVehiclePictures(generaterSwapUtil.getFileNameInJson(vo.getVehiclePictures()));
Map<String,Object> businessIdMap = new HashMap<>();
vo.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",vo.getBusinessId(),businessIdMap));
Map<String,Object> naturalIdMap = new HashMap<>();
vo.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",vo.getNaturalId(),naturalIdMap));
return ActionResult.success(vo);
}
}
/**
*
*
* @param id
* @return
*/
/**
*
*
* @param id
* @return
*/
@PutMapping("/{id}")
@Transactional
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid TradeuploadUpForm tradeuploadUpForm) throws DataException {
@ -790,16 +790,16 @@ public class TradeuploadController {
TradeuploadEntity entity= tradeuploadService.getInfo(id);
if(entity!=null){
TradeuploadEntity subentity=JsonUtil.getJsonToBean(tradeuploadUpForm, TradeuploadEntity.class);
subentity.setCreatorTime(entity.getCreatorTime());
subentity.setCreatorTime(entity.getCreatorTime());
QueryWrapper<TradeuploadEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TradeuploadEntity::getPoundlistNo,entity.getPoundlistNo());
queryWrapper.lambda().eq(TradeuploadEntity::getCustomerId,entity.getCustomerId());
List<TradeuploadEntity> list = tradeuploadService.list(queryWrapper);
if (list != null && list.size()>0 && !ObjectUtil.equal("id", list.get(0).getId())){
if (list != null && list.size()>0 && !ObjectUtil.equal(id, list.get(0).getId())){
return ActionResult.fail("磅单重复");
}
tradeuploadService.update(id, subentity);
return ActionResult.success("更新成功");
return ActionResult.success("更新成功");
}else{
return ActionResult.fail("更新失败,数据不存在");
}
@ -807,12 +807,12 @@ public class TradeuploadController {
/**
*
*
* @param id
* @return
*/
/**
*
*
* @param id
* @return
*/
@DeleteMapping("/{id}")
@Transactional
public ActionResult delete(@PathVariable("id") String id){

@ -430,24 +430,24 @@
contractTypeOptions: [{
"fullName": "采购合同",
"id": "1"
"id": "0"
}, {
"fullName": "销售合同",
"id": "2"
"id": "1"
},
{
"fullName": "租赁合同",
"id": "3"
"id": "2"
}, {
"fullName": "仓储合同",
"id": "4"
"id": "3"
}, {
"fullName": "运输合同",
"id": "5"
"id": "4"
},
{
"fullName": "施工合同",
"id": "6"
"id": "5"
}
],
rateOptions:[

@ -114,8 +114,8 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否垫资" prop="advance" @change="advanceChange">
<el-select v-model="advance" placeholder="请选择" clearable :style='{"width":"100%"}'>
<el-form-item label="是否垫资" prop="advance">
<el-select v-model="advance" placeholder="请选择" clearable :style='{"width":"100%"}' @change="advanceChange">
<el-option v-for="(item, index) in advanceOptions" :key="index" :label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
@ -517,6 +517,9 @@
var grossWeight = this.dataForm.grossWeight;//
var buckleWeight = this.dataForm.buckleWeight;//
var netWeight = this.dataForm.netWeight;//
this.dataForm.unit = this.dataForm.unit ? this.dataForm.unit : 0;
this.dataForm.transportType = this.dataForm.transportType ? this.dataForm.transportType : 0;
this.dataForm.advance = this.dataForm.advance ? this.dataForm.advance : 0;
if(grossWeight < tareWeight + buckleWeight + netWeight){
this.$message({
message: '毛重不得小于皮重+扣重+净重',

@ -0,0 +1,745 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1500px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right">
<template v-if="!loading">
<el-col :span="24">
<el-form-item label="磅单上传" prop="poundPictures">
<el-upload class="avatar-uploader" :action="action" :show-file-list="false"
:on-success="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料名称" prop="materialId">
<popupSelect v-model="dataForm.materialId" placeholder="请选择物料编码" clearable field="materialId"
interfaceId="381037852907038533" :columnOptions="materialIdcolumnOptions" propsValue="id"
relationField="item_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage
:pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="customerId">
<popupSelect v-model="dataForm.customerId" placeholder="请选择客户" clearable field="customerId"
interfaceId="395936123471343749" :columnOptions="customerIdcolumnOptions" propsValue="id"
relationField="supplier_nm" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage
:pageSize="20" @change="customerSelect">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售合同" prop="salesId">
<popupSelect v-model="dataForm.salesId" placeholder="请选择合同" clearable field="salesId"
interfaceId="396203872441416837" :columnOptions="salesIdcolumnOptions" propsValue="id"
relationField="contract_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" :bissId="dataForm.customerId"
hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商" prop="supplierId">
<popupSelect v-model="dataForm.supplierId" placeholder="请选择客户" clearable field="supplierId"
interfaceId="395936123471343749" :columnOptions="supplierIdcolumnOptions" propsValue="id"
relationField="supplier_nm" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage
:pageSize="20" @change="customerSelect">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采购合同" prop="salesId">
<popupSelect v-model="dataForm.salesId" placeholder="请选择合同" clearable field="salesId"
interfaceId="396203872441416837" :columnOptions="salesIdcolumnOptions" propsValue="id"
relationField="contract_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" :bissId="dataForm.supplierId"
hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="采购价格" prop="purchasePrice">
<el-input-number v-model="dataForm.purchasePrice" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="车牌号" prop="vehicleId">
<popupSelect v-model="dataForm.vehicleId" placeholder="请选择车辆" clearable field="vehicleId"
interfaceId="381432451370615173" :columnOptions="vehicleIdcolumnOptions" propsValue="id"
relationField="ticketno" popupType="dialog" popupTitle="选择数据" popupWidth="800px" @change="changePicture"
hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="车辆图片" prop="vehiclePictures">
<JNPF-UploadImg v-model="dataForm.vehiclePictures" :fileSize="500" sizeUnit="MB" :limit="9">
</JNPF-UploadImg>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="磅单时间" prop="poundDate">
<el-date-picker v-model="dataForm.poundDate" placeholder="请选择" clearable :style='{"width":"100%"}'
type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="磅单号" prop="poundlistNo">
<el-input v-model="dataForm.poundlistNo" placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="皮重" prop="tareWeight">
<el-input-number v-model="dataForm.tareWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="毛重" prop="grossWeight">
<el-input-number v-model="dataForm.grossWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="扣重" prop="buckleWeight">
<el-input-number v-model="dataForm.buckleWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="净重" prop="netWeight">
<el-input-number v-model="dataForm.netWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位 " prop="unit">
<el-select v-model="unit" placeholder="请选择" clearable :style='{"width":"100%"}' @change="unitChange">
<el-option v-for="(item, index) in unitOptions" :key="index" :label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运输类型" prop="transportType">
<el-select v-model="transportType" placeholder="请选择" clearable :style='{"width":"100%"}' @change="transportTypeChange">
<el-option v-for="(item, index) in transportTypeOptions" :key="index" :label="item.fullName"
:value="item.id" :disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否垫资" prop="advance">
<el-select v-model="advance" placeholder="请选择" clearable :style='{"width":"100%"}' @change="advanceChange">
<el-option v-for="(item, index) in advanceOptions" :key="index" :label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="运费" prop="transportPrice">
<el-input-number v-model="dataForm.transportPrice" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="销售价格" prop="salesPrice">
<el-input-number v-model="dataForm.salesPrice" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="业务员" prop="businessId">
<popupSelect v-model="dataForm.businessId" placeholder="请选择业务员" clearable field="businessId"
interfaceId="ebcc44be142e43b795c0d769abd6d25a" :columnOptions="businessIdcolumnOptions"
propsValue="F_Id" relationField="F_RealName" popupType="dialog" popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" :bissId="dataForm.businessId">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="自然人" prop="naturalId">
<popupSelect v-model="dataForm.naturalId" placeholder="请选择自然人" clearable field="naturalId"
interfaceId="395933800510599301" :columnOptions="naturalIdcolumnOptions" propsValue="id"
relationField="name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注信息" clearable :style='{"width":"100%"}'>
</el-input>
</el-form-item>
</el-col>
</template>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> </el-button>
<el-button type="primary" @click="continueUpload()"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import {
getDataInterfaceRes
} from '@/api/systemData/dataInterface'
import {
getDictionaryDataSelector
} from '@/api/systemData/dictionary'
export default {
components: {},
props: [],
data() {
return {
unit: "0",
transportType: "0",
advance: "0",
action: this.define.APIURl + '/api/tradeupload/Tradeupload/UploaderPondList/annexpic',
imageUrl: '',
code: '100',
fileList: [],
visible: false,
loading: false,
isDetail: false,
dataForm: {
poundPictures: [],
materialId: "",
customerId: "",
supplierId: "",
salesId: "",
vehicleId: "",
vehiclePictures: [],
poundDate: '',
poundlistNo: '',
tareWeight: 0,
grossWeight: 0,
buckleWeight: 0,
netWeight: 0,
unit: "0",
transportType: "0",
advance: "0",
transportPrice: 0,
salesPrice: 0,
purchasePrice: 0,
businessId: "",
naturalId: "",
remark: '',
creatorTime: "",
},
rules: {
materialId: [{
required: true,
message: '请选择物料编码',
trigger: 'change'
}, ],
customerId: [{
required: true,
message: '请选择客户',
trigger: 'change'
}, ],
supplierId: [{
required: true,
message: '请选择供应商',
trigger: 'change'
}, ],
salesId: [{
required: true,
message: '请选择合同',
trigger: 'change'
}, ],
vehicleId: [{
required: true,
message: '请选择车辆',
trigger: 'change'
}, ],
vehiclePictures: [{
required: true,
message: '请至少选择一个',
trigger: 'click'
}, ],
poundDate: [{
required: true,
message: '请选择',
trigger: 'change'
}, ],
poundlistNo: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
tareWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
grossWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
buckleWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
netWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
salesPrice: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
purchasePrice: [{
required: true,
message: '请输入',
trigger: 'blur'
}, ],
businessId: [{
required: true,
message: '请选择业务员',
trigger: 'change'
}, ],
},
materialIdcolumnOptions: [{
"label": "物料编码",
"value": "item_code"
}, {
"label": "物料名称",
"value": "item_name"
}, {
"label": "单位",
"value": "primary_unit_of_measure"
}, {
"label": "默认入库区",
"value": "in_area"
}, {
"label": "默认出库区",
"value": "out_area"
}, ],
customerIdcolumnOptions: [{
"label": "客户编码",
"value": "supplier_cd"
}, {
"label": "客户名称",
"value": "supplier_nm"
}, {
"label": "地址",
"value": "address"
}, {
"label": "银行账号",
"value": "bank_account"
}, ],
supplierIdcolumnOptions: [{
"label": "供应商编码",
"value": "supplier_code"
}, {
"label": "供应商名称",
"value": "supplier_name"
}],
salesIdcolumnOptions: [{
"label": "合同编码",
"value": "contract_code"
}, {
"label": "合同名称",
"value": "contract_name"
}, {
"label": "合同类型",
"value": "contract_type"
}, {
"label": "供应商/客户名称",
"value": "name"
}, ],
vehicleIdcolumnOptions: [{
"label": "车牌号",
"value": "ticketno"
}, {
"label": "司机",
"value": "drivername"
}, {
"label": "车辆照片",
"value": "vehiclephotos"
}, {
"label": "手机号",
"value": "contact"
}, ],
unitOptions: [{
"fullName": "吨",
"id": "0"
}, {
"fullName": "千克",
"id": "1"
}],
transportTypeOptions: [{
"fullName": "汽运",
"id": "0"
}, {
"fullName": "船运",
"id": "1"
}, {
"fullName": "火车",
"id": "2"
}],
advanceOptions: [{
"fullName": "否",
"id": "0"
}, {
"fullName": "是",
"id": "1"
}],
businessIdcolumnOptions: [{
"label": "人员名称",
"value": "F_RealName"
}, {
"label": "人员职位",
"value": "F_FullName"
}, ],
naturalIdcolumnOptions: [{
"label": "自然人名称",
"value": "name"
}, {
"label": "自然人手机号",
"value": "contact"
}, {
"label": "自然人地址",
"value": "adress"
}, ],
}
},
computed: {},
watch: {},
created() {},
mounted() {},
methods: {
unitChange(e){
this.dataForm.unit = e;
},
transportTypeChange(e){
this.dataForm.transportType = e;
},
advanceChange(e){
this.dataForm.advance = e;
},
customerSelect(e, d) {
const query = {
code: d.id
}
request({
url: '/api/example/ContractFile/getListByCustomer',
method: 'post',
data: query
}).then((res) => {
if(res.data.length > 0){
// type
this.dataForm.salesId = res.data[0].id
this.dataForm.salesName = res.data[0].contractName
}
})
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
this.dataForm.customerId = res.data.customerId;
this.dataForm.customerName = res.data.customerName;
this.dataForm.salesId = res.data.salesId;
this.dataForm.salesName = res.data.salesName;
this.dataForm.vehicleId = res.data.vehicleId;
this.dataForm.poundDate = res.data.poundDate;
this.dataForm.poundlistNo = res.data.poundlistNo;
this.dataForm.tareWeight = res.data.tareWeight;
this.dataForm.grossWeight = res.data.grossWeight;
this.dataForm.buckleWeight = res.data.buckleWeight;
this.dataForm.netWeight = res.data.netWeight;
this.dataForm.vehiclePictures = JSON.parse(res.data.vehiclePictures);
},
changePicture(a, b) {
this.dataForm.vehiclePictures = JSON.parse(b.vehiclephotos);
},
continueUpload() {
var tareWeight = this.dataForm.tareWeight;//
var grossWeight = this.dataForm.grossWeight;//
var buckleWeight = this.dataForm.buckleWeight;//
var netWeight = this.dataForm.netWeight;//
if(grossWeight < tareWeight + buckleWeight + netWeight){
this.$message({
message: '毛重不得小于皮重+扣重+净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= netWeight){
this.$message({
message: '扣重不得大于净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= grossWeight){
this.$message({
message: '扣重不得大于毛重',
type: 'success',
duration: 1000
})
return
}
this.$refs['elForm'].validate((valid) => {
if (valid) {
this.request3()
}
})
},
// poundAI(){
// let formData = new FormData();
// let file = this.dataForm.poundPictures
// formData.append('file',file);
// request({
// url: '/api/tradeupload/Tradeupload/poundai',
// method: 'post',
// data: formData
// }).then(res => {
// this.dataInfo(res.data)
// this.loading = false
// });
// },
clearData(data) {
for (let key in data) {
if (data[key] instanceof Array) {
data[key] = [];
} else if (data[key] instanceof Object) {
this.clearData(data[key]);
} else {
data[key] = "";
}
}
},
init(id, isDetail) {
this.dataForm.poundDate = new Date();
this.dataForm.id = id || 0;
this.visible = true;
this.isDetail = isDetail || false;
this.$nextTick(() => {
this.$refs['elForm'].resetFields();
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
} else {
this.clearData(this.dataForm)
}
});
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
this.dataForm.businessId = this.$store.state.user.userInfo.userId;
this.dataForm.businessName = this.$store.state.user.userInfo.userName;
},
//
dataFormSubmit() {
var tareWeight = this.dataForm.tareWeight;//
var grossWeight = this.dataForm.grossWeight;//
var buckleWeight = this.dataForm.buckleWeight;//
var netWeight = this.dataForm.netWeight;//
this.dataForm.unit = this.dataForm.unit ? this.dataForm.unit : 0;
this.dataForm.transportType = this.dataForm.transportType ? this.dataForm.transportType : 0;
this.dataForm.advance = this.dataForm.advance ? this.dataForm.advance : 0;
if(grossWeight < tareWeight + buckleWeight + netWeight){
this.$message({
message: '毛重不得小于皮重+扣重+净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= netWeight){
this.$message({
message: '扣重不得大于净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= grossWeight){
this.$message({
message: '扣重不得大于毛重',
type: 'success',
duration: 1000
})
return
}
this.$refs['elForm'].validate((valid) => {
if (valid) {
this.request2()
}
})
},
request2() {
var _data = this.dataList()
debugger
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
},
request3() {
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
})
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
})
})
}
this.dataForm.vehicleId = null;
this.dataForm.vehiclePictures = null;
this.dataForm.poundDate = null;
this.dataForm.poundlistNo = null;
this.dataForm.tareWeight = null;
this.dataForm.grossWeight = null;
this.dataForm.buckleWeight = null;
this.dataForm.netWeight = null;
},
request() {
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
},
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForm));
_data.poundPictures = JSON.stringify(_data.poundPictures)
_data.vehiclePictures = JSON.stringify(_data.vehiclePictures)
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
_dataAll.poundPictures = JSON.parse(_dataAll.poundPictures)
_dataAll.vehiclePictures = JSON.parse(_dataAll.vehiclePictures)
this.dataForm = _dataAll
},
},
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>

@ -84,13 +84,46 @@
/>
<el-table-column prop="salesPrice" label="销售价格" width="150" align="center" sortable
/>
<el-table-column prop="creatorUserName" label="业务员" width="120" align="center" sortable
<el-table-column prop="businessId" label="业务员" width="120" align="center" sortable
/>
<el-table-column prop="remark" label="备注" width="200" align="center" sortable
/>
<el-table-column prop="poundPictures" label="磅单图片" width="150" align="center">
<template slot-scope="scope">
<span v-for="(item,index) in JSON.parse(scope.row.poundPictures)" :key="index">
<el-popover placement="bottom" trigger="click" width="1000">
<img :src="`/dev${item.url}`" width="100%" />
<img
slot="reference"
:src="`/dev${item.url}`"
:alt="`/dev${item.url}`"
style="max-height: 70px;max-width: 70px; padding: 5px"
/>
</el-popover>
</span>
</template>
</el-table-column>
<el-table-column prop="vehiclePictures" label="车辆图片" width="150" align="center">
<template slot-scope="scope">
<span v-for="(item,index) in JSON.parse(scope.row.vehiclePictures)" :key="index">
<el-popover placement="bottom" trigger="click" width="1000">
<img :src="`/dev${item.url}`" width="100%" />
<img
slot="reference"
:src="`/dev${item.url}`"
:alt="`/dev${item.url}`"
style="max-height: 70px;max-width: 70px; padding: 5px"
/>
</el-popover>
</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right"
width="150">
<template slot-scope="scope">
<el-button type="text"
@click="addOrUpdateHandle2(scope.row.id)">审核
</el-button>
<el-button type="text"
@click="addOrUpdateHandle(scope.row.id)">编辑
</el-button>
@ -107,6 +140,7 @@
</div>
</div>
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
<JNPF-Form v-if="formVisible2" ref="JNPFForm2" @refresh="refresh2"/>
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
</div>
@ -116,12 +150,14 @@
import request from '@/utils/request'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import JNPFForm from './Form'
import JNPFForm2 from './Form2'
import ExportBox from './ExportBox'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import Detail from './Detail'
export default {
components: { JNPFForm, ExportBox, Detail },
components: { JNPFForm, JNPFForm2, ExportBox, Detail },
data() {
return {
detailVisible: false,
@ -144,6 +180,7 @@
sidx: ''
},
formVisible: false,
formVisible2: false,
exportBoxVisible: false,
columnList: [
{ prop: 'creatorTime', label: '磅单日期' },
@ -274,6 +311,12 @@
this.$refs.JNPFForm.init(id, isDetail)
})
},
addOrUpdateHandle2(id, isDetail) {
this.formVisible2 = true
this.$nextTick(() => {
this.$refs.JNPFForm2.init(id, isDetail)
})
},
exportData() {
this.exportBoxVisible = true
this.$nextTick(() => {
@ -306,6 +349,10 @@
this.formVisible = false
if (isrRefresh) this.reset()
},
refresh2(isrRefresh) {
this.formVisible2 = false
if (isrRefresh) this.reset()
},
reset() {
for (let key in this.query) {
this.query[key] = undefined

Loading…
Cancel
Save