This commit is contained in:
xd 2024-04-02 11:24:37 +08:00
parent 26b071c447
commit b1beb49d54
16 changed files with 2060 additions and 5 deletions

View File

@ -0,0 +1,172 @@
package com.ruoyi.web.controller.quot;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.MinioUtil;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.quot.domain.QuotFile;
import com.ruoyi.quot.service.IQuotFileService;
import com.ruoyi.web.utils.IdUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.quot.domain.Quot;
import com.ruoyi.quot.service.IQuotService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 报价Controller
*
* @author ruoyi
* @date 2024-04-01
*/
@RestController
@RequestMapping("/quot/quot")
public class QuotController extends BaseController
{
@Autowired
private IQuotService quotService;
@Autowired
private IQuotFileService quotFileService;
/**
* 查询报价列表
*/
@PreAuthorize("@ss.hasPermi('quot:quot:list')")
@GetMapping("/list")
public TableDataInfo list(Quot quot)
{
startPage();
List<Quot> list = quotService.selectQuotList(quot);
return getDataTable(list);
}
/**
* 导出报价列表
*/
@PreAuthorize("@ss.hasPermi('quot:quot:export')")
@Log(title = "报价", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, Quot quot)
{
List<Quot> list = quotService.selectQuotList(quot);
ExcelUtil<Quot> util = new ExcelUtil<Quot>(Quot.class);
util.exportExcel(response, list, "报价数据");
}
/**
* 获取报价详细信息
*/
@PreAuthorize("@ss.hasPermi('quot:quot:query')")
@GetMapping(value = "/{quotId}")
public AjaxResult getInfo(@PathVariable("quotId") String quotId)
{
return success(quotService.selectQuotByQuotId(quotId));
}
/**
* 新增报价
*/
@PreAuthorize("@ss.hasPermi('quot:quot:add')")
@Log(title = "报价", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Quot quot)
{
quot.setQuotId(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername());
return toAjax(quotService.insertQuot(quot));
}
/**
* 修改报价
*/
@PreAuthorize("@ss.hasPermi('quot:quot:edit')")
@Log(title = "报价", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Quot quot)
{
return toAjax(quotService.updateQuot(quot));
}
/**
* 删除报价
*/
@PreAuthorize("@ss.hasPermi('quot:quot:remove')")
@Log(title = "报价", businessType = BusinessType.DELETE)
@DeleteMapping("/{quotIds}")
public AjaxResult remove(@PathVariable String[] quotIds)
{
return toAjax(quotService.deleteQuotByQuotIds(quotIds));
}
/**
* 头像上传SysNoticeMapper
*/
@Log(title = "上传报价附件", businessType = BusinessType.INSERT)
@PostMapping("/quotFile")
public AjaxResult quotFile(@RequestParam("quotFile") MultipartFile file,@RequestParam("quotId") String quotId) throws Exception
{
if(!StringUtils.isEmpty(quotId)){
if (!file.isEmpty())
{
QuotFile quotFile= new QuotFile();
quotFile.setFileId(UUID.fastUUID().toString());
String url = FileUploadUtils.uploadMinio(file,"quot-manage", "quot/"+quotId);
int index = url.lastIndexOf("/")+1;
String fileName = url.substring(index);
quotFile.setFileName(fileName);
quotFile.setFileUrl(url);
quotFile.setFileSize(file.getSize());
quotFile.setFileTime(DateUtils.getTime());
quotFile.setQuotId(quotId);
quotFileService.insertQuotFile(quotFile);
}
}else{
return error("系统异常,报价单号为空!");
}
return success("上传成功!");
}
/**
* 查询附件列表
*/
@PreAuthorize("@ss.hasPermi('quot:quot:list')")
@GetMapping("/quotFileList")
public TableDataInfo quotFileList(QuotFile quotFile)
{
startPage();
List<QuotFile> list = quotFileService.selectQuotFileList(quotFile);
return getDataTable(list);
}
/**
* 删除附件列表
*/
@PreAuthorize("@ss.hasPermi('quot:quot:list')")
@PostMapping("/quotFileDelete")
public AjaxResult quotFileDelete(QuotFile quotFile) {
String fileId = quotFile.getFileId();
try {
QuotFile quotfile = quotFileService.selectQuotFileByFileId(fileId);
quotFileService.deleteQuotFileByFileId(fileId);
MinioUtil.removeObject("quot-manage", quotfile.getFileName());
}catch(Exception e){
return error("系统异常!");
}
return success();
}
}

View File

@ -68,6 +68,8 @@ public class SysLoginController
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
//获取SAP编码 名称 TODO
return ajax;
}

View File

@ -0,0 +1,320 @@
package com.ruoyi.quot.domain;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 报价对象 quot
*
* @author ruoyi
* @date 2024-04-01
*/
public class Quot extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private String quotId;
/** 报价单号 */
@Excel(name = "报价单号")
private String quotCode;
/** 业务员编码 */
private String quotSalesmanBm;
/** 业务员 */
@Excel(name = "业务员")
private String quotSalesmanName;
/** 客户编码 */
private String quotCustomerBm;
/** 客户名称 */
@Excel(name = "客户名称")
private String quotCustomerName;
/** 业务员所属部门id */
private String quotSalesmanDeptId;
/** 业务员所属部门 */
private String quotSalesmanDeptName;
/** 地址 */
private String quotAddress;
/** 联系电话 */
private String quotPhone;
/** 询价日期 */
@Excel(name = "询价日期")
private String quotInquiryDate;
/** 项目名称 */
@Excel(name = "项目名称")
private String quotProject;
/** 报价日期 */
@Excel(name = "报价日期")
private String quotQuotationDate;
/** 报价来源 */
private String quotQuotationFrom;
/** 报价要求 */
@Excel(name = "报价要求")
private String quotQuotationRequire;
/** 反馈说明 */
@Excel(name = "反馈说明")
private String quotFeedbackExplanation;
/** 数量 */
@Excel(name = "数量")
private String quotQuantity;
/** 总价 */
@Excel(name = "总价")
private String quotTotalPrice;
/** 审核人账号 */
private String quotCheckUserName;
/** 审核人 */
@Excel(name = "审核人")
private String quotCheckUserNickname;
/** 提交状态 */
@Excel(name = "提交状态")
private String quotApprovalStatus;
/** 报价单-产品信息 */
private List<QuotMaterial> quotMaterialList;
public void setQuotId(String quotId)
{
this.quotId = quotId;
}
public String getQuotId()
{
return quotId;
}
public void setQuotCode(String quotCode)
{
this.quotCode = quotCode;
}
public String getQuotCode()
{
return quotCode;
}
public void setQuotSalesmanBm(String quotSalesmanBm)
{
this.quotSalesmanBm = quotSalesmanBm;
}
public String getQuotSalesmanBm()
{
return quotSalesmanBm;
}
public void setQuotSalesmanName(String quotSalesmanName)
{
this.quotSalesmanName = quotSalesmanName;
}
public String getQuotSalesmanName()
{
return quotSalesmanName;
}
public void setQuotCustomerName(String quotCustomerName)
{
this.quotCustomerName = quotCustomerName;
}
public String getQuotCustomerBm() {return quotCustomerBm;}
public void setQuotCustomerBm(String quotCustomerBm) {this.quotCustomerBm = quotCustomerBm;}
public String getQuotCustomerName()
{
return quotCustomerName;
}
public void setQuotSalesmanDeptId(String quotSalesmanDeptId)
{
this.quotSalesmanDeptId = quotSalesmanDeptId;
}
public String getQuotSalesmanDeptId()
{
return quotSalesmanDeptId;
}
public void setQuotSalesmanDeptName(String quotSalesmanDeptName)
{
this.quotSalesmanDeptName = quotSalesmanDeptName;
}
public String getQuotSalesmanDeptName()
{
return quotSalesmanDeptName;
}
public void setQuotAddress(String quotAddress)
{
this.quotAddress = quotAddress;
}
public String getQuotAddress()
{
return quotAddress;
}
public void setQuotPhone(String quotPhone)
{
this.quotPhone = quotPhone;
}
public String getQuotPhone()
{
return quotPhone;
}
public void setQuotInquiryDate(String quotInquiryDate)
{
this.quotInquiryDate = quotInquiryDate;
}
public String getQuotInquiryDate()
{
return quotInquiryDate;
}
public void setQuotProject(String quotProject)
{
this.quotProject = quotProject;
}
public String getQuotProject()
{
return quotProject;
}
public void setQuotQuotationDate(String quotQuotationDate)
{
this.quotQuotationDate = quotQuotationDate;
}
public String getQuotQuotationDate()
{
return quotQuotationDate;
}
public void setQuotQuotationFrom(String quotQuotationFrom)
{
this.quotQuotationFrom = quotQuotationFrom;
}
public String getQuotQuotationFrom()
{
return quotQuotationFrom;
}
public void setQuotQuotationRequire(String quotQuotationRequire)
{
this.quotQuotationRequire = quotQuotationRequire;
}
public String getQuotQuotationRequire()
{
return quotQuotationRequire;
}
public void setQuotFeedbackExplanation(String quotFeedbackExplanation)
{
this.quotFeedbackExplanation = quotFeedbackExplanation;
}
public String getQuotFeedbackExplanation()
{
return quotFeedbackExplanation;
}
public void setQuotQuantity(String quotQuantity)
{
this.quotQuantity = quotQuantity;
}
public String getQuotQuantity()
{
return quotQuantity;
}
public void setQuotTotalPrice(String quotTotalPrice)
{
this.quotTotalPrice = quotTotalPrice;
}
public String getQuotTotalPrice()
{
return quotTotalPrice;
}
public void setQuotCheckUserName(String quotCheckUserName)
{
this.quotCheckUserName = quotCheckUserName;
}
public String getQuotCheckUserName()
{
return quotCheckUserName;
}
public void setQuotCheckUserNickname(String quotCheckUserNickname)
{
this.quotCheckUserNickname = quotCheckUserNickname;
}
public String getQuotCheckUserNickname()
{
return quotCheckUserNickname;
}
public void setQuotApprovalStatus(String quotApprovalStatus)
{
this.quotApprovalStatus = quotApprovalStatus;
}
public String getQuotApprovalStatus()
{
return quotApprovalStatus;
}
public List<QuotMaterial> getQuotMaterialList()
{
return quotMaterialList;
}
public void setQuotMaterialList(List<QuotMaterial> quotMaterialList)
{
this.quotMaterialList = quotMaterialList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("quotId", getQuotId())
.append("quotCode", getQuotCode())
.append("quotSalesmanBm", getQuotSalesmanBm())
.append("quotSalesmanName", getQuotSalesmanName())
.append("quotCustomerName", getQuotCustomerName())
.append("quotSalesmanDeptId", getQuotSalesmanDeptId())
.append("quotSalesmanDeptName", getQuotSalesmanDeptName())
.append("quotAddress", getQuotAddress())
.append("quotPhone", getQuotPhone())
.append("quotInquiryDate", getQuotInquiryDate())
.append("quotProject", getQuotProject())
.append("quotQuotationDate", getQuotQuotationDate())
.append("quotQuotationFrom", getQuotQuotationFrom())
.append("quotQuotationRequire", getQuotQuotationRequire())
.append("quotFeedbackExplanation", getQuotFeedbackExplanation())
.append("quotQuantity", getQuotQuantity())
.append("quotTotalPrice", getQuotTotalPrice())
.append("quotCheckUserName", getQuotCheckUserName())
.append("quotCheckUserNickname", getQuotCheckUserNickname())
.append("quotApprovalStatus", getQuotApprovalStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("quotMaterialList", getQuotMaterialList())
.toString();
}
}

View File

@ -0,0 +1,102 @@
package com.ruoyi.quot.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 报价单-文件对象 quot_file
*
* @author ruoyi
* @date 2024-04-01
*/
public class QuotFile extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private String fileId;
/** 文件名称 */
private String fileName;
/** 文件地址 */
private String fileUrl;
/** 文件大小 */
private Long fileSize;
/** 上传时间 */
private String fileTime;
/** */
private String quotId;
public void setFileId(String fileId)
{
this.fileId = fileId;
}
public String getFileId()
{
return fileId;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
public String getFileName()
{
return fileName;
}
public void setFileUrl(String fileUrl)
{
this.fileUrl = fileUrl;
}
public String getFileUrl()
{
return fileUrl;
}
public void setFileSize(Long fileSize)
{
this.fileSize = fileSize;
}
public Long getFileSize()
{
return fileSize;
}
public void setFileTime(String fileTime)
{
this.fileTime = fileTime;
}
public String getFileTime()
{
return fileTime;
}
public void setQuotId(String quotId)
{
this.quotId = quotId;
}
public String getQuotId()
{
return quotId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fileId", getFileId())
.append("fileName", getFileName())
.append("fileUrl", getFileUrl())
.append("fileSize", getFileSize())
.append("fileTime", getFileTime())
.append("quotId", getQuotId())
.toString();
}
}

View File

@ -0,0 +1,115 @@
package com.ruoyi.quot.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 报价单-产品对象 quot_material
*
* @author ruoyi
* @date 2024-04-01
*/
public class QuotMaterial extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private String matId;
/** 型号 */
private String matXingh;
/** 规格 */
private String matGuig;
/** 电压 */
private String matDiany;
/** 单位 */
private String matDanw;
/** 数量 */
private Long matSl;
/** */
private String quotId;
public void setMatId(String matId)
{
this.matId = matId;
}
public String getMatId()
{
return matId;
}
public void setMatXingh(String matXingh)
{
this.matXingh = matXingh;
}
public String getMatXingh()
{
return matXingh;
}
public void setMatGuig(String matGuig)
{
this.matGuig = matGuig;
}
public String getMatGuig()
{
return matGuig;
}
public void setMatDiany(String matDiany)
{
this.matDiany = matDiany;
}
public String getMatDiany()
{
return matDiany;
}
public void setMatDanw(String matDanw)
{
this.matDanw = matDanw;
}
public String getMatDanw()
{
return matDanw;
}
public void setMatSl(Long matSl)
{
this.matSl = matSl;
}
public Long getMatSl()
{
return matSl;
}
public void setQuotId(String quotId)
{
this.quotId = quotId;
}
public String getQuotId()
{
return quotId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("matId", getMatId())
.append("matXingh", getMatXingh())
.append("matGuig", getMatGuig())
.append("matDiany", getMatDiany())
.append("matDanw", getMatDanw())
.append("matSl", getMatSl())
.append("quotId", getQuotId())
.toString();
}
}

View File

@ -0,0 +1,46 @@
package com.ruoyi.quot.mapper;
import com.ruoyi.quot.domain.QuotFile;
import java.util.List;
/**
* 报价单-文件Mapper接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface QuotFileMapper
{
/**
* 查询报价单-文件
*
* @param fileId 报价单-文件主键
* @return 报价单-文件
*/
public QuotFile selectQuotFileByFileId(String fileId);
/**
* 查询报价单-文件列表
*
* @param quotFile 报价单-文件
* @return 报价单-文件集合
*/
public List<QuotFile> selectQuotFileList(QuotFile quotFile);
/**
* 新增报价单-文件
*
* @param quotFile 报价单-文件
* @return 结果
*/
public int insertQuotFile(QuotFile quotFile);
/**
* 删除报价单-文件
*
* @param fileId 报价单-文件主键
* @return 结果
*/
public int deleteQuotFileByFileId(String fileId);
}

View File

@ -0,0 +1,87 @@
package com.ruoyi.quot.mapper;
import java.util.List;
import com.ruoyi.quot.domain.Quot;
import com.ruoyi.quot.domain.QuotMaterial;
/**
* 报价Mapper接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface QuotMapper
{
/**
* 查询报价
*
* @param quotId 报价主键
* @return 报价
*/
public Quot selectQuotByQuotId(String quotId);
/**
* 查询报价列表
*
* @param quot 报价
* @return 报价集合
*/
public List<Quot> selectQuotList(Quot quot);
/**
* 新增报价
*
* @param quot 报价
* @return 结果
*/
public int insertQuot(Quot quot);
/**
* 修改报价
*
* @param quot 报价
* @return 结果
*/
public int updateQuot(Quot quot);
/**
* 删除报价
*
* @param quotId 报价主键
* @return 结果
*/
public int deleteQuotByQuotId(String quotId);
/**
* 批量删除报价
*
* @param quotIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteQuotByQuotIds(String[] quotIds);
/**
* 批量删除报价单-产品
*
* @param quotIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteQuotMaterialByQuotIds(String[] quotIds);
/**
* 批量新增报价单-产品
*
* @param quotMaterialList 报价单-产品列表
* @return 结果
*/
public int batchQuotMaterial(List<QuotMaterial> quotMaterialList);
/**
* 通过报价主键删除报价单-产品信息
*
* @param quotId 报价ID
* @return 结果
*/
public int deleteQuotMaterialByQuotId(String quotId);
}

View File

@ -0,0 +1,47 @@
package com.ruoyi.quot.service;
import com.ruoyi.quot.domain.QuotFile;
import java.util.List;
/**
* 报价单-文件Service接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface IQuotFileService
{
/**
* 查询报价单-文件
*
* @param fileId 报价单-文件主键
* @return 报价单-文件
*/
public QuotFile selectQuotFileByFileId(String fileId);
/**
* 查询报价单-文件列表
*
* @param quotFile 报价单-文件
* @return 报价单-文件集合
*/
public List<QuotFile> selectQuotFileList(QuotFile quotFile);
/**
* 新增报价单-文件
*
* @param quotFile 报价单-文件
* @return 结果
*/
public int insertQuotFile(QuotFile quotFile);
/**
* 删除报价单-文件信息
*
* @param fileId 报价单-文件主键
* @return 结果
*/
public int deleteQuotFileByFileId(String fileId);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.quot.service;
import java.util.List;
import com.ruoyi.quot.domain.Quot;
/**
* 报价Service接口
*
* @author ruoyi
* @date 2024-04-01
*/
public interface IQuotService
{
/**
* 查询报价
*
* @param quotId 报价主键
* @return 报价
*/
public Quot selectQuotByQuotId(String quotId);
/**
* 查询报价列表
*
* @param quot 报价
* @return 报价集合
*/
public List<Quot> selectQuotList(Quot quot);
/**
* 新增报价
*
* @param quot 报价
* @return 结果
*/
public int insertQuot(Quot quot);
/**
* 修改报价
*
* @param quot 报价
* @return 结果
*/
public int updateQuot(Quot quot);
/**
* 批量删除报价
*
* @param quotIds 需要删除的报价主键集合
* @return 结果
*/
public int deleteQuotByQuotIds(String[] quotIds);
/**
* 删除报价信息
*
* @param quotId 报价主键
* @return 结果
*/
public int deleteQuotByQuotId(String quotId);
}

View File

@ -0,0 +1,74 @@
package com.ruoyi.quot.service.impl;
import java.util.List;
import com.ruoyi.quot.domain.QuotFile;
import com.ruoyi.quot.mapper.QuotFileMapper;
import com.ruoyi.quot.service.IQuotFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 报价单-文件Service业务层处理
*
* @author ruoyi
* @date 2024-04-01
*/
@Service
public class QuotFileServiceImpl implements IQuotFileService
{
@Autowired
private QuotFileMapper quotFileMapper;
/**
* 查询报价单-文件
*
* @param fileId 报价单-文件主键
* @return 报价单-文件
*/
@Override
public QuotFile selectQuotFileByFileId(String fileId)
{
return quotFileMapper.selectQuotFileByFileId(fileId);
}
/**
* 查询报价单-文件列表
*
* @param quotFile 报价单-文件
* @return 报价单-文件
*/
@Override
public List<QuotFile> selectQuotFileList(QuotFile quotFile)
{
return quotFileMapper.selectQuotFileList(quotFile);
}
/**
* 新增报价单-文件
*
* @param quotFile 报价单-文件
* @return 结果
*/
@Override
@Transactional
public int insertQuotFile(QuotFile quotFile)
{
return quotFileMapper.insertQuotFile(quotFile);
}
/**
* 删除报价单-文件信息
*
* @param fileId 报价单-文件主键
* @return 结果
*/
@Override
@Transactional
public int deleteQuotFileByFileId(String fileId)
{
return quotFileMapper.deleteQuotFileByFileId(fileId);
}
}

View File

@ -0,0 +1,134 @@
package com.ruoyi.quot.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.quot.domain.QuotMaterial;
import com.ruoyi.quot.mapper.QuotMapper;
import com.ruoyi.quot.domain.Quot;
import com.ruoyi.quot.service.IQuotService;
/**
* 报价Service业务层处理
*
* @author ruoyi
* @date 2024-04-01
*/
@Service
public class QuotServiceImpl implements IQuotService
{
@Autowired
private QuotMapper quotMapper;
/**
* 查询报价
*
* @param quotId 报价主键
* @return 报价
*/
@Override
public Quot selectQuotByQuotId(String quotId)
{
return quotMapper.selectQuotByQuotId(quotId);
}
/**
* 查询报价列表
*
* @param quot 报价
* @return 报价
*/
@Override
public List<Quot> selectQuotList(Quot quot)
{
return quotMapper.selectQuotList(quot);
}
/**
* 新增报价
*
* @param quot 报价
* @return 结果
*/
@Transactional
@Override
public int insertQuot(Quot quot)
{
quot.setCreateTime(DateUtils.getNowDate());
int rows = quotMapper.insertQuot(quot);
insertQuotMaterial(quot);
return rows;
}
/**
* 修改报价
*
* @param quot 报价
* @return 结果
*/
@Transactional
@Override
public int updateQuot(Quot quot)
{
quot.setUpdateTime(DateUtils.getNowDate());
quotMapper.deleteQuotMaterialByQuotId(quot.getQuotId());
insertQuotMaterial(quot);
return quotMapper.updateQuot(quot);
}
/**
* 批量删除报价
*
* @param quotIds 需要删除的报价主键
* @return 结果
*/
@Transactional
@Override
public int deleteQuotByQuotIds(String[] quotIds)
{
quotMapper.deleteQuotMaterialByQuotIds(quotIds);
return quotMapper.deleteQuotByQuotIds(quotIds);
}
/**
* 删除报价信息
*
* @param quotId 报价主键
* @return 结果
*/
@Transactional
@Override
public int deleteQuotByQuotId(String quotId)
{
quotMapper.deleteQuotMaterialByQuotId(quotId);
return quotMapper.deleteQuotByQuotId(quotId);
}
/**
* 新增报价单-产品信息
*
* @param quot 报价对象
*/
public void insertQuotMaterial(Quot quot)
{
List<QuotMaterial> quotMaterialList = quot.getQuotMaterialList();
String quotId = quot.getQuotId();
if (StringUtils.isNotNull(quotMaterialList))
{
List<QuotMaterial> list = new ArrayList<QuotMaterial>();
for (QuotMaterial quotMaterial : quotMaterialList)
{
quotMaterial.setQuotId(quotId);
list.add(quotMaterial);
}
if (list.size() > 0)
{
quotMapper.batchQuotMaterial(list);
}
}
}
}

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.quot.mapper.QuotFileMapper">
<resultMap type="QuotFile" id="QuotFileResult">
<result property="fileId" column="file_id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="fileSize" column="file_size" />
<result property="fileTime" column="file_time" />
<result property="quotId" column="quot_id" />
</resultMap>
<sql id="selectQuotFileVo">
select file_id, file_name, file_url, file_size, file_time, quot_id from quot_file
</sql>
<select id="selectQuotFileList" parameterType="QuotFile" resultMap="QuotFileResult">
<include refid="selectQuotFileVo"/>
<where>
<if test="quotId != null and quotId != ''"> and quot_id = #{quotId}</if>
</where>
</select>
<select id="selectQuotFileByFileId" parameterType="String" resultMap="QuotFileResult">
<include refid="selectQuotFileVo"/>
where file_id = #{fileId}
</select>
<insert id="insertQuotFile" parameterType="QuotFile">
insert into quot_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fileId != null">file_id,</if>
<if test="fileName != null">file_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="fileSize != null">file_size,</if>
<if test="fileTime != null">file_time,</if>
<if test="quotId != null">quot_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fileId != null">#{fileId},</if>
<if test="fileName != null">#{fileName},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="fileTime != null">#{fileTime},</if>
<if test="quotId != null">#{quotId},</if>
</trim>
</insert>
<delete id="deleteQuotFileByFileId" parameterType="String">
delete from quot_file where file_id = #{fileId}
</delete>
</mapper>

View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.quot.mapper.QuotMapper">
<resultMap type="Quot" id="QuotResult">
<result property="quotId" column="quot_id" />
<result property="quotCode" column="quot_code" />
<result property="quotSalesmanBm" column="quot_salesman_bm" />
<result property="quotSalesmanName" column="quot_salesman_name" />
<result property="quotCustomerBm" column="quot_customer_bm" />
<result property="quotCustomerName" column="quot_customer_name" />
<result property="quotSalesmanDeptId" column="quot_salesman_dept_id" />
<result property="quotSalesmanDeptName" column="quot_salesman_dept_name" />
<result property="quotAddress" column="quot_address" />
<result property="quotPhone" column="quot_phone" />
<result property="quotInquiryDate" column="quot_inquiry_date" />
<result property="quotProject" column="quot_project" />
<result property="quotQuotationDate" column="quot_quotation_date" />
<result property="quotQuotationFrom" column="quot_quotation_from" />
<result property="quotQuotationRequire" column="quot_quotation_require" />
<result property="quotFeedbackExplanation" column="quot_feedback_explanation" />
<result property="quotQuantity" column="quot_quantity" />
<result property="quotTotalPrice" column="quot_total_price" />
<result property="quotCheckUserName" column="quot_check_user_name" />
<result property="quotCheckUserNickname" column="quot_check_user_nickname" />
<result property="quotApprovalStatus" column="quot_approval_status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="QuotQuotMaterialResult" type="Quot" extends="QuotResult">
<collection property="quotMaterialList" notNullColumn="sub_mat_id" javaType="java.util.List" resultMap="QuotMaterialResult" />
</resultMap>
<resultMap type="QuotMaterial" id="QuotMaterialResult">
<result property="matId" column="sub_mat_id" />
<result property="matXingh" column="sub_mat_xingh" />
<result property="matGuig" column="sub_mat_guig" />
<result property="matDiany" column="sub_mat_diany" />
<result property="matDanw" column="sub_mat_danw" />
<result property="matSl" column="sub_mat_sl" />
<result property="quotId" column="sub_quot_id" />
</resultMap>
<sql id="selectQuotVo">
select quot_id, quot_code, quot_salesman_bm, quot_salesman_name, quot_customer_bm,
quot_customer_name,quot_salesman_dept_id, quot_salesman_dept_name, quot_address,
quot_phone, quot_inquiry_date, quot_project, quot_quotation_date, quot_quotation_from,
quot_quotation_require, quot_feedback_explanation, quot_quantity, quot_total_price,
quot_check_user_name, quot_check_user_nickname, quot_approval_status,
create_by, create_time, update_by, update_time from quot
</sql>
<select id="selectQuotList" parameterType="Quot" resultMap="QuotResult">
<include refid="selectQuotVo"/>
<where>
<if test="quotCode != null and quotCode != ''"> and quot_code like concat('%', #{quotCode}, '%')</if>
<if test="quotCustomerName != null and quotCustomerName != ''"> and quot_customer_name like concat('%', #{quotCustomerName}, '%')</if>
<if test="quotProject != null and quotProject != ''"> and quot_project like concat('%', #{quotProject}, '%')</if>
<if test="quotApprovalStatus != null and quotApprovalStatus != ''"> and quot_approval_status = #{quotApprovalStatus}</if>
</where>
</select>
<select id="selectQuotByQuotId" parameterType="String" resultMap="QuotQuotMaterialResult">
select a.quot_id, a.quot_code, a.quot_salesman_bm, a.quot_salesman_name, a.quot_customer_name, a.quot_salesman_dept_id, a.quot_salesman_dept_name, a.quot_address, a.quot_phone, a.quot_inquiry_date, a.quot_project, a.quot_quotation_date, a.quot_quotation_from, a.quot_quotation_require, a.quot_feedback_explanation, a.quot_quantity, a.quot_total_price, a.quot_check_user_name, a.quot_check_user_nickname, a.quot_approval_status, a.create_by, a.create_time, a.update_by, a.update_time,
b.mat_id as sub_mat_id, b.mat_xingh as sub_mat_xingh, b.mat_guig as sub_mat_guig, b.mat_diany as sub_mat_diany, b.mat_danw as sub_mat_danw, b.mat_sl as sub_mat_sl, b.quot_id as sub_quot_id
from quot a
left join quot_material b on b.quot_id = a.quot_id
where a.quot_id = #{quotId}
</select>
<insert id="insertQuot" parameterType="Quot">
insert into quot
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quotId != null and quotId != ''">quot_id,</if>
<if test="quotCode != null and quotCode != ''">quot_code,</if>
<if test="quotSalesmanBm != null and quotSalesmanBm != ''">quot_salesman_bm,</if>
<if test="quotSalesmanName != null and quotSalesmanName != ''">quot_salesman_name,</if>
<if test="quotCustomerBm != null and quotCustomerBm != ''">quot_customer_bm,</if>
<if test="quotCustomerName != null and quotCustomerName != ''">quot_customer_name,</if>
<if test="quotSalesmanDeptId != null">quot_salesman_dept_id,</if>
<if test="quotSalesmanDeptName != null">quot_salesman_dept_name,</if>
<if test="quotAddress != null">quot_address,</if>
<if test="quotPhone != null">quot_phone,</if>
<if test="quotInquiryDate != null">quot_inquiry_date,</if>
<if test="quotProject != null and quotProject != ''">quot_project,</if>
<if test="quotQuotationDate != null">quot_quotation_date,</if>
<if test="quotQuotationFrom != null">quot_quotation_from,</if>
<if test="quotQuotationRequire != null and quotQuotationRequire != ''">quot_quotation_require,</if>
<if test="quotFeedbackExplanation != null">quot_feedback_explanation,</if>
<if test="quotQuantity != null">quot_quantity,</if>
<if test="quotTotalPrice != null">quot_total_price,</if>
<if test="quotCheckUserName != null">quot_check_user_name,</if>
<if test="quotCheckUserNickname != null">quot_check_user_nickname,</if>
<if test="quotApprovalStatus != null">quot_approval_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quotId != null and quotId != ''">#{quotId},</if>
<if test="quotCode != null and quotCode != ''">#{quotCode},</if>
<if test="quotSalesmanBm != null and quotSalesmanBm != ''">#{quotSalesmanBm},</if>
<if test="quotSalesmanName != null and quotSalesmanName != ''">#{quotSalesmanName},</if>
<if test="quotCustomerBm != null and quotCustomerBm != ''">#{quotCustomerBm},</if>
<if test="quotCustomerName != null and quotCustomerName != ''">#{quotCustomerName},</if>
<if test="quotSalesmanDeptId != null">#{quotSalesmanDeptId},</if>
<if test="quotSalesmanDeptName != null">#{quotSalesmanDeptName},</if>
<if test="quotAddress != null">#{quotAddress},</if>
<if test="quotPhone != null">#{quotPhone},</if>
<if test="quotInquiryDate != null">#{quotInquiryDate},</if>
<if test="quotProject != null and quotProject != ''">#{quotProject},</if>
<if test="quotQuotationDate != null">#{quotQuotationDate},</if>
<if test="quotQuotationFrom != null">#{quotQuotationFrom},</if>
<if test="quotQuotationRequire != null and quotQuotationRequire != ''">#{quotQuotationRequire},</if>
<if test="quotFeedbackExplanation != null">#{quotFeedbackExplanation},</if>
<if test="quotQuantity != null">#{quotQuantity},</if>
<if test="quotTotalPrice != null">#{quotTotalPrice},</if>
<if test="quotCheckUserName != null">#{quotCheckUserName},</if>
<if test="quotCheckUserNickname != null">#{quotCheckUserNickname},</if>
<if test="quotApprovalStatus != null">#{quotApprovalStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateQuot" parameterType="Quot">
update quot
<trim prefix="SET" suffixOverrides=",">
<if test="quotCode != null and quotCode != ''">quot_code = #{quotCode},</if>
<if test="quotSalesmanBm != null and quotSalesmanBm != ''">quot_salesman_bm = #{quotSalesmanBm},</if>
<if test="quotSalesmanName != null and quotSalesmanName != ''">quot_salesman_name = #{quotSalesmanName},</if>
<if test="quotCustomerBm != null and quotCustomerBm != ''">quot_customer_bm = #{quotCustomerBm},</if>
<if test="quotCustomerName != null and quotCustomerName != ''">quot_customer_name = #{quotCustomerName},</if>
<if test="quotSalesmanDeptId != null">quot_salesman_dept_id = #{quotSalesmanDeptId},</if>
<if test="quotSalesmanDeptName != null">quot_salesman_dept_name = #{quotSalesmanDeptName},</if>
<if test="quotAddress != null">quot_address = #{quotAddress},</if>
<if test="quotPhone != null">quot_phone = #{quotPhone},</if>
<if test="quotInquiryDate != null">quot_inquiry_date = #{quotInquiryDate},</if>
<if test="quotProject != null and quotProject != ''">quot_project = #{quotProject},</if>
<if test="quotQuotationDate != null">quot_quotation_date = #{quotQuotationDate},</if>
<if test="quotQuotationFrom != null">quot_quotation_from = #{quotQuotationFrom},</if>
<if test="quotQuotationRequire != null and quotQuotationRequire != ''">quot_quotation_require = #{quotQuotationRequire},</if>
<if test="quotFeedbackExplanation != null">quot_feedback_explanation = #{quotFeedbackExplanation},</if>
<if test="quotQuantity != null">quot_quantity = #{quotQuantity},</if>
<if test="quotTotalPrice != null">quot_total_price = #{quotTotalPrice},</if>
<if test="quotCheckUserName != null">quot_check_user_name = #{quotCheckUserName},</if>
<if test="quotCheckUserNickname != null">quot_check_user_nickname = #{quotCheckUserNickname},</if>
<if test="quotApprovalStatus != null">quot_approval_status = #{quotApprovalStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where quot_id = #{quotId}
</update>
<delete id="deleteQuotByQuotId" parameterType="String">
delete from quot where quot_id = #{quotId}
</delete>
<delete id="deleteQuotByQuotIds" parameterType="String">
delete from quot where quot_id in
<foreach item="quotId" collection="array" open="(" separator="," close=")">
#{quotId}
</foreach>
</delete>
<delete id="deleteQuotMaterialByQuotIds" parameterType="String">
delete from quot_material where quot_id in
<foreach item="quotId" collection="array" open="(" separator="," close=")">
#{quotId}
</foreach>
</delete>
<delete id="deleteQuotMaterialByQuotId" parameterType="String">
delete from quot_material where quot_id = #{quotId}
</delete>
<insert id="batchQuotMaterial">
insert into quot_material( mat_id, mat_xingh, mat_guig, mat_diany, mat_danw, mat_sl, quot_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.matId}, #{item.matXingh}, #{item.matGuig}, #{item.matDiany}, #{item.matDanw}, #{item.matSl}, #{item.quotId})
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,63 @@
import request from '@/utils/request'
// 查询报价列表
export function listQuot(query) {
return request({
url: '/quot/quot/list',
method: 'get',
params: query
})
}
// 查询报价详细
export function getQuot(quotId) {
return request({
url: '/quot/quot/' + quotId,
method: 'get'
})
}
// 新增报价
export function addQuot(data) {
return request({
url: '/quot/quot',
method: 'post',
data: data
})
}
// 修改报价
export function updateQuot(data) {
return request({
url: '/quot/quot',
method: 'put',
data: data
})
}
// 删除报价
export function delQuot(quotId) {
return request({
url: '/quot/quot/' + quotId,
method: 'delete'
})
}
// 查询附件列表
export function quotFileList(query) {
return request({
url: '/quot/quot/quotFileList',
method: 'get',
params: query
})
}
//删除附件
export function quotFileDelete(fileId) {
return request({
url: '/quot/quot/quotFileDelete',
method: 'post',
params: {fileId:fileId}
})
}

View File

@ -9,7 +9,11 @@ const user = {
name: '',
avatar: '',
roles: [],
permissions: []
permissions: [],
sapBm: '',
sapUserName: '',
deptId: '',
deptName: ''
},
mutations: {
@ -30,6 +34,18 @@ const user = {
},
SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions
},
SET_SAPBM: (state, sapBm) => {
state.sapBm = sapBm
},
SET_SAPUSERNAME: (state, sapUserName) => {
state.sapUserName = sapUserName
},
SET_DEPTID: (state, deptId) => {
state.deptId = deptId
},
SET_DEPTNAME: (state, deptName) => {
state.deptName = deptName
}
},
@ -82,6 +98,11 @@ const user = {
commit('SET_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
commit('SET_SAPBM', '4100000058')
commit('SET_SAPUSERNAME', '薛建梅')
commit('SET_DEPTID', user.dept.deptId)
commit('SET_DEPTNAME', user.dept.deptName)
resolve(res)
}).catch(error => {
reject(error)

View File

@ -0,0 +1,563 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="报价单号" prop="quotCode">
<el-input
v-model="queryParams.quotCode"
placeholder="请输入报价单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="quotCustomerName">
<el-input
v-model="queryParams.quotCustomerName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="项目名称" prop="quotProject">
<el-input
v-model="queryParams.quotProject"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="提交状态" prop="quotApprovalStatus">
<el-select v-model="queryParams.quotApprovalStatus" placeholder="请选择提交状态" clearable>
<el-option
v-for="dict in dict.type.quot_approval_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['quot:quot:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['quot:quot:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['quot:quot:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['quot:quot:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="quotList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报价单ID" align="center" prop="quotId" v-if="false"/>
<el-table-column label="报价单号" align="center" prop="quotCode">
<template slot-scope="scope">
<el-link v-hasPermi="['quot:quot:edit']" :underline="false" type="primary" @click="handleUpdate(scope.row)">{{scope.row.quotCode}}</el-link>
</template>
</el-table-column>
<el-table-column label="业务员" align="center" prop="quotSalesmanName" />
<el-table-column label="客户名称" align="center" prop="quotCustomerName" />
<el-table-column label="询价日期" align="center" prop="quotInquiryDate" />
<el-table-column label="项目名称" align="center" prop="quotProject" />
<el-table-column label="报价日期" align="center" prop="quotQuotationDate" />
<el-table-column label="报价要求" align="center" prop="quotQuotationRequire" />
<el-table-column label="反馈说明" align="center" prop="quotFeedbackExplanation" />
<el-table-column label="数量" align="center" prop="quotQuantity" />
<el-table-column label="总价" align="center" prop="quotTotalPrice" />
<el-table-column label="审核人" align="center" prop="quotCheckUserNickname" />
<el-table-column label="提交状态" align="center" prop="quotApprovalStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.quot_approval_status" :value="scope.row.quotApprovalStatus"/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改报价对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1050px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-tabs v-model="activeName" style="margin-left: 15px; margin-right: 15px;">
<el-tab-pane label="报价信息" name="quotInfo">
<el-row :gutter="8">
<el-col :span="8">
<el-form-item label="报价单号" prop="quotCode">
<el-input v-model="form.quotCode" placeholder="系统自动生成" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="业务员" prop="quotSalesmanName">
<el-input v-model="form.quotSalesmanName" :disabled="true"/>
<el-input v-model="form.quotSalesmanBm" v-if="false"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="所属部门" prop="quotSalesmanDeptName">
<el-input v-model="form.quotSalesmanDeptName" :disabled="true"/>
<el-input v-model="form.quotSalesmanDeptId" v-if="false"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="16">
<el-form-item label="客户" prop="quotCustomerName">
<el-input v-model="form.quotCustomerBm" v-if="false"/>
<el-input v-model="form.quotCustomerName" placeholder="请输入客户" :disabled="true">
<el-button slot="append" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="联系电话" prop="quotPhone">
<el-input v-model="form.quotPhone" placeholder="请输入联系电话" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24">
<el-form-item label="地址" prop="quotAddress">
<el-input v-model="form.quotAddress" placeholder="请输入地址" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="项目名称" prop="quotProject">
<el-input v-model="form.quotProject" placeholder="请输入项目名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报价来源" prop="quotQuotationFrom">
<el-input v-model="form.quotQuotationFrom" placeholder="请输入报价来源" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24">
<el-form-item label="报价要求" prop="quotQuotationRequire">
<el-input v-model="form.quotQuotationRequire" placeholder="请输入报价要求" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24">
<el-form-item label="反馈说明" prop="quotFeedbackExplanation">
<el-input v-model="form.quotFeedbackExplanation" placeholder="请输入反馈说明" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="8">
<el-form-item label="数量" prop="quotQuantity">
<el-input v-model="form.quotQuantity" placeholder="请输入数量" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="总价" prop="quotTotalPrice">
<el-input v-model="form.quotTotalPrice" placeholder="请输入总价" />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="产品" name="matInfo">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddQuotMaterial">添加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteQuotMaterial">删除</el-button>
</el-col>
</el-row>
<el-table :data="quotMaterialList" :row-class-name="rowQuotMaterialIndex" @selection-change="handleQuotMaterialSelectionChange" ref="quotMaterial">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="型号" prop="matXingh">
<template slot-scope="scope">
<el-input v-model="scope.row.matXingh" placeholder="请输入型号" />
</template>
</el-table-column>
<el-table-column label="规格" prop="matGuig">
<template slot-scope="scope">
<el-input v-model="scope.row.matGuig" placeholder="请输入规格" />
</template>
</el-table-column>
<el-table-column label="电压" prop="matDiany">
<template slot-scope="scope">
<el-input v-model="scope.row.matDiany" placeholder="请输入电压" />
</template>
</el-table-column>
<el-table-column label="单位" prop="matDanw">
<template slot-scope="scope">
<el-input v-model="scope.row.matDanw" placeholder="请输入单位" />
</template>
</el-table-column>
<el-table-column label="数量" prop="matSl">
<template slot-scope="scope">
<el-input v-model="scope.row.matSl" placeholder="请输入数量" />
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="附件" name="fileInfo">
<el-upload class="upload-demo"
ref="upload"
name="quotFile"
:action="uploadUrl"
:headers="headers"
:data="{ quotId: this.form.quotId }"
:on-success="handleAvatarSuccess"
:show-file-list="false"
:limit="1">
<el-button slot="trigger" size="small" type="primary">上传文件</el-button>
</el-upload>
<el-table class="down" :data="dataList" border stripe style="width: 100%;margin-top: 20px;" height="300px">
<el-table-column prop="fileName" label="文件名称" width="500px"></el-table-column>
<el-table-column prop="fileSize" label="文件大小" width="150px">
<template slot-scope="scope">
<span v-if="scope.row.fileSize / 1024 / 1024 < 1">{{(scope.row.fileSize / 1024).toFixed(2) + 'KB'}}</span>
<span v-else>{{(scope.row.fileSize / 1024 / 1024).toFixed(2) + 'MB'}}</span>
</template>
</el-table-column>
<el-table-column prop="fileTime" label="上传时间"></el-table-column>
<el-table-column width="150px" label="操作">
<template slot-scope="scope">
<el-button size="small" type="text">
<a @click="downloadFile(scope.row.fileUrl)">下载</a>
</el-button>
<el-button size="small" type="text" @click="deleteFile(scope.row.fileId)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<style>
.el-dialog__body {
padding: 10px 10px;
color: #606266;
font-size: 14px;
word-break: break-all;
overflow-y: auto; /* 自动显示垂直滚动条 */
max-height: 560px; /* 设置最大高度,根据需要调整 */
}
</style>
<script>
import { listQuot, getQuot, delQuot, addQuot, updateQuot, quotFileList, quotFileDelete } from "@/api/quot/quot";
import { getToken } from "@/utils/auth";
export default {
name: "Quot",
dicts: ['quot_approval_status'],
data() {
return {
//
activeName: 'quotInfo',
//
loading: true,
//
ids: [],
//
checkedQuotMaterial: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
quotList: [],
// -
quotMaterialList: [],
// -
dataList: [],
//
uploadUrl: process.env.VUE_APP_BASE_API + "/quot/quot/quotFile",
headers: {
Authorization: "Bearer " + getToken()
},
//
uploadObjs: {
quot_id:""
},
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
quotCode: null,
quotCustomerName: null,
quotProject: null,
quotApprovalStatus: null,
},
//
form: {},
//
rules: {
quotSalesmanBm: [
{ required: true, message: "业务员编码不能为空", trigger: "blur" }
],
quotSalesmanName: [
{ required: true, message: "业务员不能为空", trigger: "blur" }
],
/*quotCustomerName: [
{ required: true, message: "客户名称不能为空", trigger: "blur" }
],*/
quotProject: [
{ required: true, message: "项目名称不能为空", trigger: "blur" }
],
quotQuotationRequire: [
{ required: true, message: "报价要求不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询报价列表 */
getList() {
this.loading = true;
listQuot(this.queryParams).then(response => {
this.quotList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
quotId: null,
quotCode: null,
quotSalesmanBm: null,
quotSalesmanName: null,
quotCustomerBm: null,
quotCustomerName: null,
quotSalesmanDeptId: null,
quotSalesmanDeptName: null,
quotAddress: null,
quotPhone: null,
quotInquiryDate: null,
quotProject: null,
quotQuotationDate: null,
quotQuotationFrom: null,
quotQuotationRequire: null,
quotFeedbackExplanation: null,
quotQuantity: null,
quotTotalPrice: null,
quotCheckUserName: null,
quotCheckUserNickname: null,
quotApprovalStatus: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.quotMaterialList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.quotId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加报价";
this.form.quotSalesmanName = this.$store.state.user.sapUserName;
this.form.quotSalesmanBm = this.$store.state.user.sapBm;
this.form.quotSalesmanDeptId = this.$store.state.user.deptId;
this.form.quotSalesmanDeptName = this.$store.state.user.deptName;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const quotId = row.quotId || this.ids
getQuot(quotId).then(response => {
this.form = response.data;
this.quotMaterialList = response.data.quotMaterialList;
this.open = true;
this.title = "修改报价";
this.getQuotFileList();
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.quotMaterialList = this.quotMaterialList;
if (this.form.quotId != null) {
updateQuot(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addQuot(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const quotIds = row.quotId || this.ids;
this.$modal.confirm('是否确认删除报价编号为"' + quotIds + '"的数据项?').then(function() {
return delQuot(quotIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 报价单-产品序号 */
rowQuotMaterialIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 报价单-产品添加按钮操作 */
handleAddQuotMaterial() {
let obj = {};
obj.matXingh = "";
obj.matGuig = "";
obj.matDiany = "";
obj.matDanw = "";
obj.matSl = "";
this.quotMaterialList.push(obj);
},
/** 报价单-产品删除按钮操作 */
handleDeleteQuotMaterial() {
if (this.checkedQuotMaterial.length == 0) {
this.$modal.msgError("请先选择要删除的报价单-产品数据");
} else {
const quotMaterialList = this.quotMaterialList;
const checkedQuotMaterial = this.checkedQuotMaterial;
this.quotMaterialList = quotMaterialList.filter(function(item) {
return checkedQuotMaterial.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleQuotMaterialSelectionChange(selection) {
this.checkedQuotMaterial = selection.map(item => item.index)
},
/** 导出按钮操作 */
handleExport() {
this.download('quot/quot/export', {
...this.queryParams
}, `quot_${new Date().getTime()}.xlsx`)
},
/*********************************附件上传*****************************************/
//
getQuotFileList(){
quotFileList(this.form.quotId).then(response => {
this.dataList = response.rows;
});
},
//
handleAvatarSuccess(res) {
//
if (res.code == 200) {
this.$modal.msgSuccess(res.msg);
this.getQuotFileList();
} else {
this.$message.msgError(res.msg);
}
this.$refs.upload.clearFiles(); //****
},
//
downloadFile(fileUrl){
window.open(fileUrl, "_blank");
},
//
deleteFile(fileId){
quotFileDelete(fileId).then(response => {
this.getQuotFileList();
});
}
}
};
</script>