Browse Source

[delete] 销售报价

删除旧销售报价的数据表
删除旧销售报价菜单列表
删除旧销售报价实体类
删除旧销售报价Controller
删除旧销售报价Mapper
删除旧销售报价Mapper.XML
删除旧销售报价Service接口
删除旧销售报价ServiceImpl实现类
dev
liuxiaoxu 4 months ago
parent
commit
46e4366caf
  1. 165
      ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java
  2. 342
      ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimate.java
  3. 77
      ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateMapper.java
  4. 77
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateService.java
  5. 136
      ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java
  6. 171
      ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateMapper.xml
  7. 620
      ruoyi-admin/src/main/resources/templates/sales/salesEstimate/add.html
  8. 615
      ruoyi-admin/src/main/resources/templates/sales/salesEstimate/detail.html
  9. 645
      ruoyi-admin/src/main/resources/templates/sales/salesEstimate/edit.html
  10. 155
      ruoyi-admin/src/main/resources/templates/sales/salesEstimate/salesEstimate.html

165
ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java

@ -1,165 +0,0 @@
package com.ruoyi.sales.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sales.domain.SalesEstimate;
import com.ruoyi.sales.service.ISalesEstimateService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 销售估价Controller
*
* @author 刘晓旭
* @date 2024-04-15
*/
@Controller
@RequestMapping("/sales/salesEstimate")
public class SalesEstimateController extends BaseController
{
private String prefix = "sales/salesEstimate";
@Autowired
private ISalesEstimateService salesEstimateService;
@RequiresPermissions("sales:salesEstimate:view")
@GetMapping()
public String salesEstimate()
{
return prefix + "/salesEstimate";
}
/**
* 查询销售估价列表
*/
@RequiresPermissions("sales:salesEstimate:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SalesEstimate salesEstimate)
{
startPage();
List<SalesEstimate> list = salesEstimateService.selectSalesEstimateList(salesEstimate);
return getDataTable(list);
}
/**
* 导出销售估价列表
*/
@RequiresPermissions("sales:salesEstimate:export")
@Log(title = "销售估价", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SalesEstimate salesEstimate)
{
List<SalesEstimate> list = salesEstimateService.selectSalesEstimateList(salesEstimate);
ExcelUtil<SalesEstimate> util = new ExcelUtil<SalesEstimate>(SalesEstimate.class);
return util.exportExcel(list, "销售估价数据");
}
/**
* 新增销售估价
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存销售估价
*/
@RequiresPermissions("sales:salesEstimate:add")
@Log(title = "销售估价", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SalesEstimate salesEstimate)
{
return toAjax(salesEstimateService.insertSalesEstimate(salesEstimate));
}
/**
* 修改销售估价
*/
@GetMapping("/edit/{aftersalesEstimateId}")
public String edit(@PathVariable("aftersalesEstimateId") Long aftersalesEstimateId, ModelMap mmap)
{
SalesEstimate salesEstimate = salesEstimateService.selectSalesEstimateById(aftersalesEstimateId);
mmap.put("salesEstimate", salesEstimate);
return prefix + "/edit";
}
@GetMapping("/detail/{id}")
public String detail(@PathVariable("id") Long id, ModelMap mmap)
{
SalesEstimate salesEstimate = salesEstimateService.selectSalesEstimateById(id);
mmap.put("salesEstimate", salesEstimate);
return prefix + "/detail";
}
/**
* 修改保存销售估价
*/
@RequiresPermissions("sales:salesEstimate:edit")
@Log(title = "销售估价", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SalesEstimate salesEstimate)
{
return toAjax(salesEstimateService.updateSalesEstimate(salesEstimate));
}
/**
* 删除销售估价
*/
@RequiresPermissions("sales:salesEstimate:remove")
@Log(title = "销售估价", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(salesEstimateService.deleteSalesEstimateByIds(ids));
}
/**
* 作废销售估价
*/
@RequiresPermissions("sales:salesEstimate:cancel")
@Log(title = "销售估价", businessType = BusinessType.CANCEL)
@GetMapping( "/cancel/{id}")
@ResponseBody
public AjaxResult cancel(@PathVariable("id") Long id){
return toAjax(salesEstimateService.cancelSalesEstimateById(id));
}
/**
* 恢复销售估价
*/
@RequiresPermissions("sales:salesEstimate:restore")
@Log(title = "销售估价", businessType = BusinessType.RESTORE)
@GetMapping( "/restore/{id}")
@ResponseBody
public AjaxResult restore(@PathVariable("id")Long id)
{
return toAjax(salesEstimateService.restoreSalesEstimateById(id));
}
@RequestMapping("/getId")
@ResponseBody
public AjaxResult getId()
{
return AjaxResult.success(salesEstimateService.getId());
}
}

342
ruoyi-admin/src/main/java/com/ruoyi/sales/domain/SalesEstimate.java

@ -1,342 +0,0 @@
package com.ruoyi.sales.domain;
import java.math.BigDecimal;
import java.util.Date;
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;
/**
* 销售估价对象 sales_estimate
*
* @author 刘晓旭
* @date 2024-04-15
*/
public class SalesEstimate extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 销售估价ID */
private Long aftersalesEstimateId;
/** 估价单号 */
@Excel(name = "估价单号")
private String aftersalesEstimateCode;
/** 用户ID */
private Long userId;
/** 估价状态 */
@Excel(name = "估价状态")
private String estimateStatus;
/** 客户代码 */
@Excel(name = "客户代码")
private String enterpriseCode;
/** 客户名称 */
@Excel(name = "客户名称")
private String enterpriseName;
/** 料号 */
@Excel(name = "料号")
private String materialNo;
/** 物料名称 */
@Excel(name = "物料名称")
private String materialName;
/** 物料合计 */
@Excel(name = "物料合计")
private String materialSum;
/** 数量合计 */
@Excel(name = "数量合计")
private String quantitySum;
/** 估价币种 */
@Excel(name = "估价币种")
private String estimateCurrencies;
/** 不含税总价(RMB) */
@Excel(name = "不含税总价", readConverterExp = "R=MB")
private BigDecimal allPriceExcludingTaxRmb;
/** 含税总价(RMB) */
@Excel(name = "含税总价", readConverterExp = "R=MB")
private BigDecimal allPriceIncludesTax;
/** 不含税总价(美元) */
@Excel(name = "不含税总价", readConverterExp = "美=元")
private BigDecimal allPriceExcludingTaxDollar;
//估价日期
private String pricingDate;
/** 流程实例ID */
private String instanceId;
/** 流程实例类型 */
private String instanceType;
/** 流程提交实例ID */
private String submitInstanceId;
/** 申请标题 */
private String applyTitle;
/** 申请时间 */
private Date applyTime;
/** 申请人 */
private String applyUser;
/** 流程作废实例ID */
private String cancelInstanceId;
/** 流程恢复实例ID */
private String restoreInstanceId;
private List<SalesEstimateChild> sysSalesEstimateChildList;
public void setPricingDate(String pricingDate) {
this.pricingDate = pricingDate;
}
public String getPricingDate() {
return pricingDate ;
}
public void setAftersalesEstimateId(Long aftersalesEstimateId)
{
this.aftersalesEstimateId = aftersalesEstimateId;
}
public Long getAftersalesEstimateId()
{
return aftersalesEstimateId;
}
public void setAftersalesEstimateCode(String aftersalesEstimateCode)
{
this.aftersalesEstimateCode = aftersalesEstimateCode;
}
public String getAftersalesEstimateCode()
{
return aftersalesEstimateCode;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setEstimateStatus(String estimateStatus)
{
this.estimateStatus = estimateStatus;
}
public String getEstimateStatus()
{
return estimateStatus;
}
public void setEnterpriseCode(String enterpriseCode)
{
this.enterpriseCode = enterpriseCode;
}
public String getEnterpriseCode()
{
return enterpriseCode;
}
public void setEnterpriseName(String enterpriseName)
{
this.enterpriseName = enterpriseName;
}
public String getEnterpriseName()
{
return enterpriseName;
}
public void setMaterialNo(String materialNo)
{
this.materialNo = materialNo;
}
public String getMaterialNo()
{
return materialNo;
}
public void setMaterialName(String materialName)
{
this.materialName = materialName;
}
public String getMaterialName()
{
return materialName;
}
public void setMaterialSum(String materialSum)
{
this.materialSum = materialSum;
}
public String getMaterialSum()
{
return materialSum;
}
public void setQuantitySum(String quantitySum)
{
this.quantitySum = quantitySum;
}
public String getQuantitySum()
{
return quantitySum;
}
public void setEstimateCurrencies(String estimateCurrencies)
{
this.estimateCurrencies = estimateCurrencies;
}
public String getEstimateCurrencies()
{
return estimateCurrencies;
}
public void setAllPriceExcludingTaxRmb(BigDecimal allPriceExcludingTaxRmb)
{
this.allPriceExcludingTaxRmb = allPriceExcludingTaxRmb;
}
public BigDecimal getAllPriceExcludingTaxRmb()
{
return allPriceExcludingTaxRmb;
}
public void setAllPriceIncludesTax(BigDecimal allPriceIncludesTax)
{
this.allPriceIncludesTax = allPriceIncludesTax;
}
public BigDecimal getAllPriceIncludesTax()
{
return allPriceIncludesTax;
}
public void setAllPriceExcludingTaxDollar(BigDecimal allPriceExcludingTaxDollar)
{
this.allPriceExcludingTaxDollar = allPriceExcludingTaxDollar;
}
public BigDecimal getAllPriceExcludingTaxDollar()
{
return allPriceExcludingTaxDollar;
}
public void setInstanceId(String instanceId)
{
this.instanceId = instanceId;
}
public String getInstanceId()
{
return instanceId;
}
public void setInstanceType(String instanceType)
{
this.instanceType = instanceType;
}
public String getInstanceType()
{
return instanceType;
}
public void setSubmitInstanceId(String submitInstanceId)
{
this.submitInstanceId = submitInstanceId;
}
public String getSubmitInstanceId()
{
return submitInstanceId;
}
public void setApplyTitle(String applyTitle)
{
this.applyTitle = applyTitle;
}
public String getApplyTitle()
{
return applyTitle;
}
public void setApplyTime(Date applyTime)
{
this.applyTime = applyTime;
}
public Date getApplyTime()
{
return applyTime;
}
public void setApplyUser(String applyUser)
{
this.applyUser = applyUser;
}
public String getApplyUser()
{
return applyUser;
}
public void setCancelInstanceId(String cancelInstanceId)
{
this.cancelInstanceId = cancelInstanceId;
}
public String getCancelInstanceId()
{
return cancelInstanceId;
}
public void setRestoreInstanceId(String restoreInstanceId)
{
this.restoreInstanceId = restoreInstanceId;
}
public String getRestoreInstanceId()
{
return restoreInstanceId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("aftersalesEstimateId", getAftersalesEstimateId())
.append("aftersalesEstimateCode", getAftersalesEstimateCode())
.append("userId", getUserId())
.append("estimateStatus", getEstimateStatus())
.append("enterpriseCode", getEnterpriseCode())
.append("enterpriseName", getEnterpriseName())
.append("materialNo", getMaterialNo())
.append("materialName", getMaterialName())
.append("materialSum", getMaterialSum())
.append("quantitySum", getQuantitySum())
.append("estimateCurrencies", getEstimateCurrencies())
.append("allPriceExcludingTaxRmb", getAllPriceExcludingTaxRmb())
.append("allPriceIncludesTax", getAllPriceIncludesTax())
.append("allPriceExcludingTaxDollar", getAllPriceExcludingTaxDollar())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("instanceId", getInstanceId())
.append("instanceType", getInstanceType())
.append("submitInstanceId", getSubmitInstanceId())
.append("applyTitle", getApplyTitle())
.append("applyTime", getApplyTime())
.append("applyUser", getApplyUser())
.append("cancelInstanceId", getCancelInstanceId())
.append("restoreInstanceId", getRestoreInstanceId())
.append("remark", getRemark())
.toString();
}
}

77
ruoyi-admin/src/main/java/com/ruoyi/sales/mapper/SalesEstimateMapper.java

@ -1,77 +0,0 @@
package com.ruoyi.sales.mapper;
import java.util.List;
import com.ruoyi.sales.domain.SalesEstimate;
/**
* 销售估价Mapper接口
*
* @author 刘晓旭
* @date 2024-04-15
*/
public interface SalesEstimateMapper
{
/**
* 查询销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 销售估价
*/
public SalesEstimate selectSalesEstimateById(Long aftersalesEstimateId);
/**
* 查询销售估价列表
*
* @param salesEstimate 销售估价
* @return 销售估价集合
*/
public List<SalesEstimate> selectSalesEstimateList(SalesEstimate salesEstimate);
/**
* 新增销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
public int insertSalesEstimate(SalesEstimate salesEstimate);
/**
* 修改销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
public int updateSalesEstimate(SalesEstimate salesEstimate);
/**
* 删除销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
public int deleteSalesEstimateById(Long aftersalesEstimateId);
/**
* 批量删除销售估价
*
* @param aftersalesEstimateIds 需要删除的数据ID
* @return 结果
*/
public int deleteSalesEstimateByIds(String[] aftersalesEstimateIds);
/**
* 作废销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
public int cancelSalesEstimateById(Long aftersalesEstimateId);
/**
* 恢复销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
public int restoreSalesEstimateById(Long aftersalesEstimateId);
}

77
ruoyi-admin/src/main/java/com/ruoyi/sales/service/ISalesEstimateService.java

@ -1,77 +0,0 @@
package com.ruoyi.sales.service;
import java.util.List;
import com.ruoyi.sales.domain.SalesEstimate;
/**
* 销售估价Service接口
*
* @author 刘晓旭
* @date 2024-04-15
*/
public interface ISalesEstimateService
{
/**
* 查询销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 销售估价
*/
public SalesEstimate selectSalesEstimateById(Long aftersalesEstimateId);
/**
* 查询销售估价列表
*
* @param salesEstimate 销售估价
* @return 销售估价集合
*/
public List<SalesEstimate> selectSalesEstimateList(SalesEstimate salesEstimate);
/**
* 新增销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
public int insertSalesEstimate(SalesEstimate salesEstimate);
/**
* 修改销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
public int updateSalesEstimate(SalesEstimate salesEstimate);
/**
* 批量删除销售估价
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSalesEstimateByIds(String ids);
/**
* 删除销售估价信息
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
public int deleteSalesEstimateById(Long aftersalesEstimateId);
/**
* 作废销售估价
* @param aftersalesEstimateId 销售估价ID
* @return
*/
int cancelSalesEstimateById(Long aftersalesEstimateId);
/**
* 恢复销售估价
* @param aftersalesEstimateId 销售估价ID
* @return
*/
int restoreSalesEstimateById(Long aftersalesEstimateId);
Object getId();
}

136
ruoyi-admin/src/main/java/com/ruoyi/sales/service/impl/SalesEstimateServiceImpl.java

@ -1,136 +0,0 @@
package com.ruoyi.sales.service.impl;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sales.mapper.SalesEstimateMapper;
import com.ruoyi.sales.domain.SalesEstimate;
import com.ruoyi.sales.service.ISalesEstimateService;
import com.ruoyi.common.core.text.Convert;
/**
* 销售估价Service业务层处理
*
* @author 刘晓旭
* @date 2024-04-15
*/
@Service
public class SalesEstimateServiceImpl implements ISalesEstimateService
{
@Autowired
private SalesEstimateMapper salesEstimateMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 销售估价
*/
@Override
public SalesEstimate selectSalesEstimateById(Long aftersalesEstimateId)
{
return salesEstimateMapper.selectSalesEstimateById(aftersalesEstimateId);
}
/**
* 查询销售估价列表
*
* @param salesEstimate 销售估价
* @return 销售估价
*/
@Override
public List<SalesEstimate> selectSalesEstimateList(SalesEstimate salesEstimate)
{
return salesEstimateMapper.selectSalesEstimateList(salesEstimate);
}
/**
* 新增销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
@Override
public int insertSalesEstimate(SalesEstimate salesEstimate)
{
String loginName = ShiroUtils.getLoginName();
salesEstimate.setCreateBy(loginName);
salesEstimate.setCreateTime(DateUtils.getNowDate());
return salesEstimateMapper.insertSalesEstimate(salesEstimate);
}
/**
* 修改销售估价
*
* @param salesEstimate 销售估价
* @return 结果
*/
@Override
public int updateSalesEstimate(SalesEstimate salesEstimate)
{
String loginName = ShiroUtils.getLoginName();
salesEstimate.setUpdateBy(loginName);
salesEstimate.setUpdateTime(DateUtils.getNowDate());
return salesEstimateMapper.updateSalesEstimate(salesEstimate);
}
/**
* 删除销售估价对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSalesEstimateByIds(String ids)
{
return salesEstimateMapper.deleteSalesEstimateByIds(Convert.toStrArray(ids));
}
/**
* 删除销售估价信息
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
@Override
public int deleteSalesEstimateById(Long aftersalesEstimateId)
{
return salesEstimateMapper.deleteSalesEstimateById(aftersalesEstimateId);
}
/**
* 作废销售估价
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
@Override
public int cancelSalesEstimateById(Long aftersalesEstimateId)
{
return salesEstimateMapper.cancelSalesEstimateById(aftersalesEstimateId);
}
/**
* 恢复销售估价信息
*
* @param aftersalesEstimateId 销售估价ID
* @return 结果
*/
@Override
public int restoreSalesEstimateById(Long aftersalesEstimateId)
{
return salesEstimateMapper.restoreSalesEstimateById(aftersalesEstimateId);
}
@Override
public Object getId() {
return redisCache.generateBillNo("GJ");
}
}

171
ruoyi-admin/src/main/resources/mapper/sales/SalesEstimateMapper.xml

@ -1,171 +0,0 @@
<?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.sales.mapper.SalesEstimateMapper">
<resultMap type="SalesEstimate" id="SalesEstimateResult">
<result property="aftersalesEstimateId" column="aftersales_estimate_id" />
<result property="aftersalesEstimateCode" column="aftersales_estimate_code" />
<result property="userId" column="user_id" />
<result property="estimateStatus" column="estimate_status" />
<result property="enterpriseCode" column="enterprise_code" />
<result property="enterpriseName" column="enterprise_name" />
<result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" />
<result property="materialSum" column="material_sum" />
<result property="quantitySum" column="quantity_sum" />
<result property="estimateCurrencies" column="estimate_currencies" />
<result property="allPriceExcludingTaxRmb" column="all_price_excluding_tax_rmb" />
<result property="allPriceIncludesTax" column="all_price_includes_tax" />
<result property="allPriceExcludingTaxDollar" column="all_price_excluding_tax_dollar" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="instanceId" column="instance_id" />
<result property="instanceType" column="instance_type" />
<result property="submitInstanceId" column="submit_instance_id" />
<result property="applyTitle" column="apply_title" />
<result property="applyTime" column="apply_time" />
<result property="applyUser" column="apply_user" />
<result property="cancelInstanceId" column="cancel_instance_id" />
<result property="restoreInstanceId" column="restore_instance_id" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSalesEstimateVo">
select aftersales_estimate_id, aftersales_estimate_code, user_id, estimate_status, enterprise_code, enterprise_name, material_no, material_name, material_sum, quantity_sum, estimate_currencies, all_price_excluding_tax_rmb, all_price_includes_tax, all_price_excluding_tax_dollar, create_by, create_time, update_by, update_time, instance_id, instance_type, submit_instance_id, apply_title, apply_time, apply_user, cancel_instance_id, restore_instance_id, remark from sales_estimate
</sql>
<select id="selectSalesEstimateList" parameterType="SalesEstimate" resultMap="SalesEstimateResult">
<include refid="selectSalesEstimateVo"/>
<where>
<if test="aftersalesEstimateCode != null and aftersalesEstimateCode != ''"> and aftersales_estimate_code = #{aftersalesEstimateCode}</if>
<if test="estimateStatus != null and estimateStatus != ''"> and estimate_status = #{estimateStatus}</if>
<if test="enterpriseCode != null and enterpriseCode != ''"> and enterprise_code = #{enterpriseCode}</if>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>
<select id="selectSalesEstimateById" parameterType="Long" resultMap="SalesEstimateResult">
<include refid="selectSalesEstimateVo"/>
where aftersales_estimate_id = #{aftersalesEstimateId}
</select>
<insert id="insertSalesEstimate" parameterType="SalesEstimate" useGeneratedKeys="true" keyProperty="aftersalesEstimateId">
insert into sales_estimate
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="aftersalesEstimateCode != null">aftersales_estimate_code,</if>
<if test="userId != null">user_id,</if>
<if test="estimateStatus != null">estimate_status,</if>
<if test="enterpriseCode != null">enterprise_code,</if>
<if test="enterpriseName != null">enterprise_name,</if>
<if test="materialNo != null">material_no,</if>
<if test="materialName != null">material_name,</if>
<if test="materialSum != null">material_sum,</if>
<if test="quantitySum != null">quantity_sum,</if>
<if test="estimateCurrencies != null">estimate_currencies,</if>
<if test="allPriceExcludingTaxRmb != null">all_price_excluding_tax_rmb,</if>
<if test="allPriceIncludesTax != null">all_price_includes_tax,</if>
<if test="allPriceExcludingTaxDollar != null">all_price_excluding_tax_dollar,</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>
<if test="instanceId != null">instance_id,</if>
<if test="instanceType != null">instance_type,</if>
<if test="submitInstanceId != null">submit_instance_id,</if>
<if test="applyTitle != null">apply_title,</if>
<if test="applyTime != null">apply_time,</if>
<if test="applyUser != null">apply_user,</if>
<if test="cancelInstanceId != null">cancel_instance_id,</if>
<if test="restoreInstanceId != null">restore_instance_id,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="aftersalesEstimateCode != null">#{aftersalesEstimateCode},</if>
<if test="userId != null">#{userId},</if>
<if test="estimateStatus != null">#{estimateStatus},</if>
<if test="enterpriseCode != null">#{enterpriseCode},</if>
<if test="enterpriseName != null">#{enterpriseName},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialSum != null">#{materialSum},</if>
<if test="quantitySum != null">#{quantitySum},</if>
<if test="estimateCurrencies != null">#{estimateCurrencies},</if>
<if test="allPriceExcludingTaxRmb != null">#{allPriceExcludingTaxRmb},</if>
<if test="allPriceIncludesTax != null">#{allPriceIncludesTax},</if>
<if test="allPriceExcludingTaxDollar != null">#{allPriceExcludingTaxDollar},</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>
<if test="instanceId != null">#{instanceId},</if>
<if test="instanceType != null">#{instanceType},</if>
<if test="submitInstanceId != null">#{submitInstanceId},</if>
<if test="applyTitle != null">#{applyTitle},</if>
<if test="applyTime != null">#{applyTime},</if>
<if test="applyUser != null">#{applyUser},</if>
<if test="cancelInstanceId != null">#{cancelInstanceId},</if>
<if test="restoreInstanceId != null">#{restoreInstanceId},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSalesEstimate" parameterType="SalesEstimate">
update sales_estimate
<trim prefix="SET" suffixOverrides=",">
<if test="aftersalesEstimateCode != null">aftersales_estimate_code = #{aftersalesEstimateCode},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="estimateStatus != null">estimate_status = #{estimateStatus},</if>
<if test="enterpriseCode != null">enterprise_code = #{enterpriseCode},</if>
<if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialSum != null">material_sum = #{materialSum},</if>
<if test="quantitySum != null">quantity_sum = #{quantitySum},</if>
<if test="estimateCurrencies != null">estimate_currencies = #{estimateCurrencies},</if>
<if test="allPriceExcludingTaxRmb != null">all_price_excluding_tax_rmb = #{allPriceExcludingTaxRmb},</if>
<if test="allPriceIncludesTax != null">all_price_includes_tax = #{allPriceIncludesTax},</if>
<if test="allPriceExcludingTaxDollar != null">all_price_excluding_tax_dollar = #{allPriceExcludingTaxDollar},</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>
<if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="cancelInstanceId != null">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null">restore_instance_id = #{restoreInstanceId},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where aftersales_estimate_id = #{aftersalesEstimateId}
</update>
<delete id="deleteSalesEstimateById" parameterType="Long">
delete from sales_estimate where aftersales_estimate_id = #{aftersalesEstimateId}
</delete>
<delete id="deleteSalesEstimateByIds" parameterType="String">
delete from sales_estimate where aftersales_estimate_id in
<foreach item="aftersalesEstimateId" collection="array" open="(" separator="," close=")">
#{aftersalesEstimateId}
</foreach>
</delete>
<update id="cancelSalesEstimateById" parameterType="Long">
update sales_estimate set del_flag = '1' where aftersales_estimate_id = #{aftersalesEstimateId}
</update>
<update id="restoreSalesEstimateById" parameterType="Long">
update sales_estimate set del_flag = '0' where aftersales_estimate_id = #{aftersalesEstimateId}
</update>
</mapper>

620
ruoyi-admin/src/main/resources/templates/sales/salesEstimate/add.html

@ -1,620 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增销售估价')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-salesEstimate-add">
<div class="form-group" hidden="hidden">
<label class="col-sm-3 control-label">估价单号:</label>
<div class="col-sm-8">
<input name="aftersalesEstimateCode" class="form-control" type="text">
</div>
</div>
<div class="form-group" shiro:hasPermission="system:estimate:edit">
<label class="col-sm-4 control-label">业务员:</label>
<div class="col-sm-8">
<select class="form-control" name="businessMembers" required>
<option value="">请选择</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">客户编号:</label>
<div class="col-sm-8">
<select class="form-control" name="customerCode" id="customerCode" required>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="customerName" id="customerName" class="form-control m-b" type="text"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">估价币种:</label>
<div class="col-sm-8">
<select class="form-control" id="commonCurrency_add" name="commonCurrency" th:with="dictList=${@dict.getType('sys_common_currency')}" required>
<option th:each="dict : ${dictList}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_add" class="form-control" type="number" placeholder="美元对人民币汇率">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">国内税率:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="rmbTax" id="rmbTax_add" class="form-control" type="number" placeholder="13" />
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">订价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="pricingDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">备注说明:</label>
<div class="col-sm-8">
<textarea readonly name="remark" class="form-control"></textarea>
</div>
</div>
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="row">
<div class="col-md-5">
<label class="col-sm-4">物料合计:</label>
<input class="col-sm-2" name="materialSum" id="materialSum_add" type="text" readonly hidden="hidden"/>
</div>
<div class="col-md-5">
<label class="col-sm-4">数量合计:</label>
<input class="col-sm-2" name="quantitySum" id="quantitySum_add" type="number" hidden="hidden" readonly/>
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input placeholder="RMB" class="col-sm-1" name="noRmbPrice" id="noRmb_add" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input placeholder="RMB" class="col-sm-1" name="rmbPrice" id="rmb_add" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input placeholder="RMB" class="col-sm-1" name="noRmbSumPrice" id="noRmbSum_add" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input placeholder="RMB" class="col-sm-1" name="rmbTaxSum" id="rmbTaxSum_add" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input placeholder="美元" class="col-sm-2" name="noUsdPrice" id="noUsd_add" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input placeholder="美元" class="col-sm-2" name="usdPrice" id="usd_add" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input placeholder="美元" class="col-sm-2" name="noUsdSum" id="noUsdSum_add" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input placeholder="美元" class="col-sm-2" name="usdTaxSum" id="usdSum_add" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
</div>
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择报价信息</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-danger multiple disabled" onclick="insertNRow()">
<i class="fa fa-remove"></i> 添加无料号物料
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-estimateChild"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "sales/salesEstimate"
var userName = [[${@permission.getPrincipalProperty('userName')}]];
$("#form-salesEstimate-add").validate({focusCleanup: true});
var customerList =[[${customerList}]];
//获取客户信息
$(function(){
$("select[name='customerCode']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择客户",
ajax:{
type: "post",
url:ctx + "system/customer/customerList",
dataType:"json",
delay:250,
cache:true,
processResults: function (res, params) {
var resultList = res.rows;
// console.log("传输的数值");
// console.log(resultList);
var options = [];
for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i];
option.id = resultList[i]["enterpriseCode"];
option.text = resultList[i]["enterpriseCode"];
options.push(option);
}
return {
results: options,
pagination: {
}
};
},
escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1
}
});
})
$('#customerCode').on('select2:select', function (e) {
var data = e.params.data;
// console.log(data);
$("input[name='customerName']").val(data.enterpriseName);
$("select[name='commonCurrency']").val(data.commonCurrency).trigger('change');
$("input[name='rmbTax']").val(data.taxRate);
$("#commonCurrency_add").val(data.commonCurrency).trigger('change');
commonCurrency = $("#commonCurrency_add option:selected").val();
});
$(function() {
var options = {
id:'bootstrap-sub-table-estimateChild',
// url: ctx + "system/estimateChild/list",
pagination: false,
sidePagination: "client",
model: "物料报价信息",
columns: [
{checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '图片',field: 'photoUrl',
formatter: function(value, row, index) {
if(value == null || value == ""){
value = "";
return "<img src='' herf='' />";
}
return $.table.imageView(value);
}
},
{title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{ title: '描述',field: 'describe',align: 'center'},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{ title: '对外售价',field: 'materialSole',
editable: {
type: 'number',
mode: 'inline',
title: '对外售价',
validate: function (value) {
if (!value) {
return '对外售价不能为空';
}
if (isNaN(value)) {
return '对外售价必须为数字';
}
}
}
},
{title: '国内税率',field: 'countTax',align: 'center',},
{ title: '美元汇率',field: 'usdTax', align: 'center',},
{field: 'materialNum',align: 'center',title: '物料的数量',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{ title: '物料的不含税单价(RMB)',
field: 'materialNoRmb',
align: 'center',
editable:{
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用
},
title: '物料的不含税单价(RMB)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{title: '物料的不含税单价(美元)',
field: 'materialNoUsd',
align: 'center',
editable: {
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用
},
title: '物料的不含税单价(美元)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{ title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',},
{ title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',},
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{field: 'createBy', align: 'center',title: '录入人',visible: false},
{field: 'createTime',align: 'center',title: '录入时间',visible: false},
{field: 'updateBy',align: 'center',title: '更新人',visible: false},
{field: 'updateTime',align: 'center',title: '上次更新时间',visible: false},
{field: 'remark',align: 'center',title: '备注',visible: false},
{field: 'auditStatus',align: 'center',title: '审核状态',visible: false,
formatter: function(value, row, index) {return $.table.selectDictLabel(auditStatusDatas, value);}
},
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
],
onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_add option:selected").val();
var rmb1 = $("#rmbTax_add").val();
if (rmb1 =='' || rmb1== null){
rmb1 = 0;
}else{
rmb1 = $("#rmbTax_add").val();
}
var rmb = parseFloat(rmb1);
var usd = $("#usdTax_add").val();
if (usd =='' || usd== null){
usd = 0;
}else{
usd = parseFloat(usd);
}
console.log(commonCurrency1);
if(commonCurrency1 == 1){
row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
}
else if( commonCurrency1 == 2){
row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
}
getTotalAmount()
},
};
$.table.init(options);
});
//获取单号
$.ajax({
url: prefix + "/getId",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='aftersalesEstimateCode']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
/*业务员列表*/
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
var usertData = res.rows;
for (let i in usertData) {
$("#form-salesEstimate-add select[name='businessMembers']").append(
"<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("#form-salesEstimate-add select[name='businessMembers']").val(userName).trigger("change");
} else {
$.modal.msgError(res.msg);
}
}
});
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-estimateChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
brand: rowData.brand,
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
materialNum: "",
materialSole: "",
materialRmb: "",
materialNoRmb: "",
materialNoUsd: "",
materialUsd: "",
materialUsdSum: "",
materialNoUsdSum: "",
materialNoRmbSum: "",
materialRmbSum: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
remark: "",
}
})
}
function insertRow() {
if ($("#customerCode").val() == null || $("#customerCode").val() == '') {
$.modal.alertWarning("请先选择客户");
return;
}
if ($("#rmbTax_add").val() == null || $("#rmbTax_add").val() == '') {
$.modal.alertWarning("请先选择输入国内的税率");
return;
}
var url = ctx + "erp/material/select";
var options = {
title: '选择料号',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(id){
$("#bootstrap-sub-table-estimateChild").bootstrapTable('remove', {
field: 'id',
values: id
})
}
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//计算金额
function getTotalAmount() {
// 获取表格数据
const data = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData', true);
// 初始化汇总对象,减少代码重复并提高清晰度
const sums = {
enterprise: "", // 用于拼接物料名称和数量
enterpriseSum: 0, // 物料总数量
currencies: {
noRmb: { total: 0, single: 0 }, // 非人民币数量与总金额
rmb: { total: 0, single: 0 }, // 人民币
noUsd: { total: 0, single: 0 }, // 非美元
usd: { total: 0, single: 0 } // 美元
}
};
// 遍历数据进行计算
for (let i = 0; i < data.length; i++) {
const item = data[i];
// 拼接物料信息
sums.enterprise += "" + item.materialName + ": 数量 : " + item.materialNum;
sums.enterpriseSum += parseFloat(item.materialNum); // 累加物料数量
// 分别累加各货币的单个金额和总金额
['noRmb', 'rmb', 'noUsd', 'usd'].forEach(currency => {
sums.currencies[currency].single += parseFloat(item['material' + [currency] ]);
sums.currencies[currency].total += parseFloat(item['material' + [currency] + 'Sum']);
});
}
updateFormValues(sums);
}
function updateFormValues(sums) {
// 物料合计与数量合计没有在sums中直接给出,这里假设它们需要单独处理或已存在于页面其他部分
$("#enterprise_add").val(sums.enterprise);
$("#enterpriseSum_add").val(sums.enterpriseSum);
// 更新不含税单价和总价
$("#noRmb_add").val(sums.currencies.noRmb.single);
$("#noRmbSum_add").val(sums.currencies.noRmb.total);
$("#rmb_add").val(sums.currencies.rmb.single);
$("#rmbSum_add").val(sums.currencies.rmb.total);
$("#noUsd_add").val(sums.currencies.noUsd.single);
$("#noUsdSum_add").val(sums.currencies.noUsd.total);
$("#usd_add").val(sums.currencies.usd.single);
$("#usdSum_add").val(sums.currencies.usd.total);
}
$(document).ready(function() {
// 监听货币选项变化
$("#commonCurrency_add").on("change", function() {
var isEditable = $(this).val() === "1";
var fieldName = "";
var materialColumnCells = $('#bootstrap-sub-table-estimateChild tbody tr td [field=" '+ fieldName+' "]');
// 根据是否可编辑,添加或移除xEditable
materialColumnCells.each(function() {
var cell = $(this);
var currentValue = cell.text().trim(); // 获取当前单元格的值
if (isEditable) {
// 如果允许编辑且尚未添加xEditable
if (!cell.hasClass('editable')) {
cell.addClass('editable'); // 添加标记类,以便跟踪状态
cell.editable({
type: 'text',
pk: cell.closest('tr').data('id'), // 假设每行有唯一ID
title: '物料的数量',
validate: function(value) {
if (!value) return '金额不能为空';
if (isNaN(value)) return '金额必须为数字';
return true;
},
success: function(response, newValue) {
// 成功后的回调,这里可以根据需要处理服务器响应
}
});
}
} else {
// 如果不允许编辑且已添加了xEditable
if (cell.hasClass('editable')) {
cell.removeClass('editable');
// 这里简化处理,实际中可能需要更复杂的逻辑来销毁xEditable实例
cell.off('.editable'); // 移除xEditable绑定的事件
cell.text(currentValue); // 还原原始文本
}
}
});
});
// 初始化时触发一次,根据默认状态设置可编辑性
$("#commonCurrency_add").trigger("change");
});
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-salesEstimate-add").serializeArray();
var tableData = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData');
console.log("tableData", JSON.stringify(tableData));
var rows = tableData.length;
if (rows == 0) {
$.modal.alertWarning("子表数据不能为空!");
} else {
formData.push({"name": "sysSalesEstimateChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData);
$.operate.saveJson(prefix + "/add", jsonData);
}
}
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

615
ruoyi-admin/src/main/resources/templates/sales/salesEstimate/detail.html

@ -1,615 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('销售估价详情')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-editable-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-salesEstimate-detail" th:object="${salesEstimate}">
<input name="aftersalesEstimateId" th:field="*{aftersalesEstimateId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">估价单号:</label>
<div class="col-sm-8">
<input name="aftersalesEstimateCode" th:field="*{aftersalesEstimateCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户ID:</label>
<div class="col-sm-8">
<input name="userId" th:field="*{userId}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价状态:</label>
<div class="col-sm-8">
<select name="estimateStatus" class="form-control m-b" th:with="type=${@dict.getType('estimate_status')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{estimateStatus}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户代码:</label>
<div class="col-sm-8">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" th:field="*{materialName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料合计:</label>
<div class="col-sm-8">
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量合计:</label>
<div class="col-sm-8">
<input name="quantitySum" th:field="*{quantitySum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价币种:</label>
<div class="col-sm-8">
<input name="estimateCurrencies" th:field="*{estimateCurrencies}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_add" class="form-control" type="number" placeholder="美元对人民币汇率" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">国内税率:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="rmbTax" id="rmbTax_add" class="form-control" type="number" placeholder="13" readonly />
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">订价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="pricingDate" th:field="*{pricingDate}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
<span class="input-group-addon" readonly><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">备注说明:</label>
<div class="col-sm-8">
<textarea th:field="*{remark}" name="remark" class="form-control" readonly></textarea>
</div>
</div>
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="row">
<div class="col-md-5">
<label class="col-sm-4">物料合计:</label>
<input class="col-sm-2" name="materialSum" id="materialSum_edit" type="text" readonly hidden="hidden"/>
<span></span>
</div>
<div class="col-md-5">
<label class="col-sm-4">数量合计:</label>
<input class="col-sm-2" name="quantitySum" id="quantitySum_edit" type="number" hidden="hidden" readonly/>
<span></span>
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input class="col-sm-1" name="noRmbPrice" id="noRmb_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input class="col-sm-1" name="rmbPrice" id="rmb_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input class="col-sm-1" name="noRmbSumPrice" id="noRmbSum_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input class="col-sm-1" name="rmbTaxSum" id="rmbTaxSum_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input class="col-sm-2" name="noUsdPrice" id="noUsd_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input class="col-sm-2" name="usdPrice" id="usd_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input class="col-sm-2" name="noUsdSum" id="noUsdSum_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input class="col-sm-2" name="usdTaxSum" id="usdSum_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
</div>
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择报价信息</span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-estimateChild"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "sales/salesEstimate";
$("#form-salesEstimate-detail").validate({focusCleanup: true});
$(function(){
$("select[name='customerCode']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择客户",
ajax:{
type: "post",
url:ctx + "system/customer/customerList",
dataType:"json",
delay:250,
cache:true,
processResults: function (res, params) {
var resultList = res.rows;
console.log("传输的数值");
console.log(resultList);
var options = [];
for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i];
option.id = resultList[i]["enterpriseCode"];
option.text = resultList[i]["enterpriseCode"];
options.push(option);
}
return {
results: options,
pagination: {
}
};
},
escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1
}
});
})
$('#customerCode').on('select2:select', function (e) {
var data = e.params.data;
$("input[name='customerName']").val(data.enterpriseName);
$("select[name='commonCurrency']").val(data.commonCurrency).trigger('change');
$("input[name='rmbTax']").val(data.taxRate);
$("#commonCurrency_add").val(data.commonCurrency).trigger('change');
commonCurrency = $("#commonCurrency_add option:selected").val();
});
$(function() {
var options = {
id:'bootstrap-sub-table-estimateChild',
// url: ctx + "system/estimateChild/list",
pagination: false,
sidePagination: "client",
model: "物料报价信息",
columns: [
{checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '图片',field: 'photoUrl',
formatter: function(value, row, index) {
if(value == null || value == ""){
value = "";
return "<img src='' herf='' />";
}
return $.table.imageView(value);
}
},
{title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{ title: '描述',field: 'describe',align: 'center'},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{ title: '对外售价',field: 'materialSole',
editable: {
type: 'number',
mode: 'inline',
title: '对外售价',
validate: function (value) {
if (!value) {
return '对外售价不能为空';
}
if (isNaN(value)) {
return '对外售价必须为数字';
}
}
}
},
{title: '国内税率',field: 'countTax',align: 'center',},
{ title: '美元汇率',field: 'usdTax', align: 'center',},
{field: 'materialNum',align: 'center',title: '物料的数量',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{ title: '物料的不含税单价(RMB)',
field: 'materialNoRmb',
align: 'center',
editable:{
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用
},
title: '物料的不含税单价(RMB)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{title: '物料的不含税单价(美元)',
field: 'materialNoUsd',
align: 'center',
editable: {
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用
},
title: '物料的不含税单价(美元)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{ title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',},
{ title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',},
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{field: 'createBy', align: 'center',title: '录入人',visible: false},
{field: 'createTime',align: 'center',title: '录入时间',visible: false},
{field: 'updateBy',align: 'center',title: '更新人',visible: false},
{field: 'updateTime',align: 'center',title: '上次更新时间',visible: false},
{field: 'remark',align: 'center',title: '备注',visible: false},
{field: 'auditStatus',align: 'center',title: '审核状态',visible: false,
formatter: function(value, row, index) {return $.table.selectDictLabel(auditStatusDatas, value);}
},
],
onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_add option:selected").val();
var rmb1 = $("#rmbTax_add").val();
if (rmb1 =='' || rmb1== null){
rmb1 = 0;
}else{
rmb1 = $("#rmbTax_add").val();
}
var rmb = parseFloat(rmb1);
var usd = $("#usdTax_add").val();
if (usd =='' || usd== null){
usd = 0;
}else{
usd = parseFloat(usd);
}
console.log(commonCurrency1);
if(commonCurrency1 == 1){
row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
}
else if( commonCurrency1 == 2){
row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
}
getTotalAmount()
},
};
$.table.init(options);
});
/*业务员列表*/
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
var usertData = res.rows;
for (let i in usertData) {
$("#form-salesEstimate-add select[name='businessMembers']").append(
"<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("#form-salesEstimate-add select[name='businessMembers']").val(userName).trigger("change");
} else {
$.modal.msgError(res.msg);
}
}
});
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-estimateChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
brand: rowData.brand,
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
materialNum: "",
materialSole: "",
materialRmb: "",
materialNoRmb: "",
materialNoUsd: "",
materialUsd: "",
materialUsdSum: "",
materialNoUsdSum: "",
materialNoRmbSum: "",
materialRmbSum: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
remark: "",
}
})
}
function insertRow() {
if ($("#customerCode").val() == null || $("#customerCode").val() == '') {
$.modal.alertWarning("请先选择客户");
return;
}
if ($("#rmbTax_add").val() == null || $("#rmbTax_add").val() == '') {
$.modal.alertWarning("请先选择输入国内的税率");
return;
}
var url = ctx + "erp/material/select";
var options = {
title: '选择料号',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(id){
$("#bootstrap-sub-table-estimateChild").bootstrapTable('remove', {
field: 'id',
values: id
})
}
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//计算金额
function getTotalAmount() {
// 获取表格数据
const data = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData', true);
// 初始化汇总对象,减少代码重复并提高清晰度
const sums = {
enterprise: "", // 用于拼接物料名称和数量
enterpriseSum: 0, // 物料总数量
currencies: {
noRmb: { total: 0, single: 0 }, // 非人民币数量与总金额
rmb: { total: 0, single: 0 }, // 人民币
noUsd: { total: 0, single: 0 }, // 非美元
usd: { total: 0, single: 0 } // 美元
}
};
// 遍历数据进行计算
for (let i = 0; i < data.length; i++) {
const item = data[i];
// 拼接物料信息
sums.enterprise += "" + item.materialName + ": 数量 : " + item.materialNum;
sums.enterpriseSum += parseFloat(item.materialNum); // 累加物料数量
// 分别累加各货币的单个金额和总金额
['noRmb', 'rmb', 'noUsd', 'usd'].forEach(currency => {
sums.currencies[currency].single += parseFloat(item['material' + [currency] ]);
sums.currencies[currency].total += parseFloat(item['material' + [currency] + 'Sum']);
});
}
updateFormValues(sums);
}
function updateFormValues(sums) {
// 物料合计与数量合计没有在sums中直接给出,这里假设它们需要单独处理或已存在于页面其他部分
$("#enterprise_edit").val(sums.enterprise);
$("#enterpriseSum_edit").val(sums.enterpriseSum);
// 更新不含税单价和总价
$("#noRmb_edit").val(sums.currencies.noRmb.single);
$("#noRmbSum_edit").val(sums.currencies.noRmb.total);
$("#rmb_edit").val(sums.currencies.rmb.single);
$("#rmbSum_edit").val(sums.currencies.rmb.total);
$("#noUsd_edit").val(sums.currencies.noUsd.single);
$("#noUsdSum_edit").val(sums.currencies.noUsd.total);
$("#usd_edit").val(sums.currencies.usd.single);
$("#usdSum_edit").val(sums.currencies.usd.total);
}
$(document).ready(function() {
// 监听货币选项变化
$("#commonCurrency_edit").on("change", function() {
var isEditable = $(this).val() === "1";
var fieldName = "";
var materialColumnCells = $('#bootstrap-sub-table-estimateChild tbody tr td [field=" '+ fieldName+' "]');
// 根据是否可编辑,添加或移除xEditable
materialColumnCells.each(function() {
var cell = $(this);
var currentValue = cell.text().trim(); // 获取当前单元格的值
if (isEditable) {
// 如果允许编辑且尚未添加xEditable
if (!cell.hasClass('editable')) {
cell.addClass('editable'); // 添加标记类,以便跟踪状态
cell.editable({
type: 'text',
pk: cell.closest('tr').data('id'), // 假设每行有唯一ID
title: '物料的数量',
validate: function(value) {
if (!value) return '金额不能为空';
if (isNaN(value)) return '金额必须为数字';
return true;
},
success: function(response, newValue) {
// 成功后的回调,这里可以根据需要处理服务器响应
}
});
}
} else {
// 如果不允许编辑且已添加了xEditable
if (cell.hasClass('editable')) {
cell.removeClass('editable');
// 这里简化处理,实际中可能需要更复杂的逻辑来销毁xEditable实例
cell.off('.editable'); // 移除xEditable绑定的事件
cell.text(currentValue); // 还原原始文本
}
}
});
});
// 初始化时触发一次,根据默认状态设置可编辑性
$("#commonCurrency_edit").trigger("change");
});
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-salesEstimate-edit").serializeArray();
var tableData = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData');
console.log("tableData", JSON.stringify(tableData));
var rows = tableData.length;
if (rows == 0) {
$.modal.alertWarning("子表数据不能为空!");
} else {
formData.push({"name": "sysSalesEstimateChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData);
$.operate.saveJson(prefix + "/add", jsonData);
}
}
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

645
ruoyi-admin/src/main/resources/templates/sales/salesEstimate/edit.html

@ -1,645 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改销售估价')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-salesEstimate-edit" th:object="${salesEstimate}">
<input name="aftersalesEstimateId" th:field="*{aftersalesEstimateId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">估价单号:</label>
<div class="col-sm-8">
<input name="aftersalesEstimateCode" th:field="*{aftersalesEstimateCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户ID:</label>
<div class="col-sm-8">
<input name="userId" th:field="*{userId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价状态:</label>
<div class="col-sm-8">
<select name="estimateStatus" class="form-control m-b" th:with="type=${@dict.getType('estimate_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{estimateStatus}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户代码:</label>
<div class="col-sm-8">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" th:field="*{materialName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料合计:</label>
<div class="col-sm-8">
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">数量合计:</label>
<div class="col-sm-8">
<input name="quantitySum" th:field="*{quantitySum}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">估价币种:</label>
<div class="col-sm-8">
<input name="estimateCurrencies" th:field="*{estimateCurrencies}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">美元汇率:</label>
<div class="col-sm-8">
<input name="usdTax" id="usdTax_add" class="form-control" type="number" placeholder="美元对人民币汇率">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">国内税率:</label>
<div class="col-sm-8">
<div class="input-group">
<input name="rmbTax" id="rmbTax_add" class="form-control" type="number" placeholder="13" />
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">订价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="pricingDate" th:field="*{pricingDate}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">备注说明:</label>
<div class="col-sm-8">
<textarea th:field="*{remark}" name="remark" class="form-control" readonly></textarea>
</div>
</div>
<div class="container">
<h4 class="form-header h4">计算</h4>
<div class="row">
<div class="col-md-5">
<label class="col-sm-4">物料合计:</label>
<input class="col-sm-2" name="materialSum" id="materialSum_edit" type="text" readonly hidden="hidden"/>
<span></span>
</div>
<div class="col-md-5">
<label class="col-sm-4">数量合计:</label>
<input class="col-sm-2" name="quantitySum" id="quantitySum_edit" type="number" hidden="hidden" readonly/>
<span></span>
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input class="col-sm-1" name="noRmbPrice" id="noRmb_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input class="col-sm-1" name="rmbPrice" id="rmb_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input class="col-sm-1" name="noRmbSumPrice" id="noRmbSum_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input class="col-sm-1" name="rmbTaxSum" id="rmbTaxSum_edit" hidden="hidden" type="number" readonly/>
<span></span>RMB
</div>
</div>
<div class="row">
<div class="col-xs-3">
<label class="col-sm-8">不含税单价:</label>
<input class="col-sm-2" name="noUsdPrice" id="noUsd_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税单价:</label>
<input class="col-sm-2" name="usdPrice" id="usd_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">不含税总价:</label>
<input class="col-sm-2" name="noUsdSum" id="noUsdSum_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
<div class="col-xs-3">
<label class="col-sm-8">含税总价:</label>
<input class="col-sm-2" name="usdTaxSum" id="usdSum_edit" hidden="hidden" type="number" readonly/>
<span></span>美元
</div>
</div>
</div>
</form>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar" role="group">
<span>选择报价信息</span>
<a class="btn btn-success" onclick="insertRow()">
<i class="fa fa-plus"></i> 添加物料
</a>
<a class="btn btn-danger multiple disabled" onclick="insertNRow()">
<i class="fa fa-remove"></i> 添加无料号物料
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-estimateChild"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "sales/salesEstimate";
$("#form-salesEstimate-edit").validate({focusCleanup: true});
$(function(){
$("select[name='customerCode']").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择客户",
ajax:{
type: "post",
url:ctx + "system/customer/customerList",
dataType:"json",
delay:250,
cache:true,
processResults: function (res, params) {
var resultList = res.rows;
console.log("传输的数值");
console.log(resultList);
var options = [];
for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i];
option.id = resultList[i]["enterpriseCode"];
option.text = resultList[i]["enterpriseCode"];
options.push(option);
}
return {
results: options,
pagination: {
}
};
},
escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1
}
});
})
$('#customerCode').on('select2:select', function (e) {
var data = e.params.data;
$("input[name='customerName']").val(data.enterpriseName);
$("select[name='commonCurrency']").val(data.commonCurrency).trigger('change');
$("input[name='rmbTax']").val(data.taxRate);
$("#commonCurrency_add").val(data.commonCurrency).trigger('change');
commonCurrency = $("#commonCurrency_add option:selected").val();
});
$(function() {
var options = {
id:'bootstrap-sub-table-estimateChild',
// url: ctx + "system/estimateChild/list",
pagination: false,
sidePagination: "client",
model: "物料报价信息",
columns: [
{checkbox: true},
{field: 'index',align: 'center', title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{title: '物料索引id',field: 'materialId',align: 'center',visible: false},
{title: '料号',field: 'materialCode',align: 'center'},
{title: '物料名称',field: 'materialName',align: 'center'},
{title: '图片',field: 'photoUrl',
formatter: function(value, row, index) {
if(value == null || value == ""){
value = "";
return "<img src='' herf='' />";
}
return $.table.imageView(value);
}
},
{title: '物料类型',field: 'materialType',align: 'center',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{ title: '描述',field: 'describe',align: 'center'},
{title: '品牌',field: 'brand',align: 'center'},
{ title: '单位',field: 'unit',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '半成品类型',field: 'processMethod',align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{ title: '对外售价',field: 'materialSole',
editable: {
type: 'number',
mode: 'inline',
title: '对外售价',
validate: function (value) {
if (!value) {
return '对外售价不能为空';
}
if (isNaN(value)) {
return '对外售价必须为数字';
}
}
}
},
{title: '国内税率',field: 'countTax',align: 'center',},
{ title: '美元汇率',field: 'usdTax', align: 'center',},
{field: 'materialNum',align: 'center',title: '物料的数量',
editable:{
type : 'text',
mode: 'inline',
title : '物料的数量',
validate : function(value) {
if (!value) {
return '用量不能为空';
}
if (isNaN(value)) {
return '用量必须为数字';
}
}
},
},
{ title: '物料的不含税单价(RMB)',
field: 'materialNoRmb',
align: 'center',
editable:{
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用
},
title: '物料的不含税单价(RMB)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{title: '物料的不含税单价(美元)',
field: 'materialNoUsd',
align: 'center',
editable: {
type: 'text', // 使用'text'类型,因为我们需自定义验证小数
mode: 'inline',
enabled: function() {
return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用
},
title: '物料的不含税单价(美元)',
validate: function(value) {
// 验证是否为空
if (!value) {
return '金额不能为空';
}
// 尝试转换为浮点数并检查是否成功
var num = parseFloat(value);
if (isNaN(num)) {
return '请输入有效的数字';
}
// 检查小数点后是否有超过两位的数字
var decimalPart = num.toString().split('.')[1]; // 获取小数部分
if (decimalPart && decimalPart.length > 2) {
return '请输入精确到小数点后两位的数字';
}
}
}
},
{ title: '物料的含税单价(美元)',field: 'materialUsd',align: 'center',},
{ title: '物料的含税总价(美元)',field: 'materialUsdSum', align: 'center',},
{ title: '物料的不含税总价(美元)',field: 'materialNoUsdSum',align: 'center',},
{ title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',},
{title: '物料的不含税总价(RMB)',field: 'materialRmbSum',align: 'center',},
{field: 'createBy', align: 'center',title: '录入人',visible: false},
{field: 'createTime',align: 'center',title: '录入时间',visible: false},
{field: 'updateBy',align: 'center',title: '更新人',visible: false},
{field: 'updateTime',align: 'center',title: '上次更新时间',visible: false},
{field: 'remark',align: 'center',title: '备注',visible: false},
{field: 'auditStatus',align: 'center',title: '审核状态',visible: false,
formatter: function(value, row, index) {return $.table.selectDictLabel(auditStatusDatas, value);}
},
{title: '操作', align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeRow(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
return actions.join('');
}
}
],
onEditableSave:function(field, row, oldValue, $el){
var commonCurrency1 = $("#commonCurrency_add option:selected").val();
var rmb1 = $("#rmbTax_add").val();
if (rmb1 =='' || rmb1== null){
rmb1 = 0;
}else{
rmb1 = $("#rmbTax_add").val();
}
var rmb = parseFloat(rmb1);
var usd = $("#usdTax_add").val();
if (usd =='' || usd== null){
usd = 0;
}else{
usd = parseFloat(usd);
}
console.log(commonCurrency1);
if(commonCurrency1 == 1){
row.materialNoRmb = parseFloat(row.materialNoRmb).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * parseFloat(1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNum * parseFloat(row.materialNoRmb)).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
row.materialNoUsd = parseFloat(row.materialNoRmb / usd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNum * row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
}
else if( commonCurrency1 == 2){
row.materialNoUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsd = parseFloat(row.materialNoUsd).toFixed(2);
row.materialUsdSum = parseFloat(row.materialNum * row.materialUsd).toFixed(2);
row.materialNoUsdSum = parseFloat(row.materialNoUsd * row.materialNum).toFixed(2);
row.materialNoRmb = parseFloat(row.materialNoUsd * usd).toFixed(2);
row.materialRmb = parseFloat(row.materialNoRmb * (1 + rmb)).toFixed(2);
row.materialNoRmbSum = parseFloat(row.materialNoRmb * row.materialNum).toFixed(2);
row.materialRmbSum = parseFloat(row.materialRmb * row.materialNum).toFixed(2);
}
getTotalAmount()
},
};
$.table.init(options);
});
//获取单号
$.ajax({
url: prefix + "/getId",
type: "post",
dateType: "json",
success: function (resp) {
if (resp.code === 0) {
$("input[name='aftersalesEstimateCode']").val(resp.data);
} else {
$.modal.msgError("失败啦");
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
});
/*业务员列表*/
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
var usertData = res.rows;
for (let i in usertData) {
$("#form-salesEstimate-add select[name='businessMembers']").append(
"<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>");
}
$("#form-salesEstimate-add select[name='businessMembers']").val(userName).trigger("change");
} else {
$.modal.msgError(res.msg);
}
}
});
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-estimateChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
brand: rowData.brand,
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
materialNum: "",
materialSole: "",
materialRmb: "",
materialNoRmb: "",
materialNoUsd: "",
materialUsd: "",
materialUsdSum: "",
materialNoUsdSum: "",
materialNoRmbSum: "",
materialRmbSum: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
remark: "",
}
})
}
function insertRow() {
if ($("#customerCode").val() == null || $("#customerCode").val() == '') {
$.modal.alertWarning("请先选择客户");
return;
}
if ($("#rmbTax_add").val() == null || $("#rmbTax_add").val() == '') {
$.modal.alertWarning("请先选择输入国内的税率");
return;
}
var url = ctx + "erp/material/select";
var options = {
title: '选择料号',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
/* 删除指定表格行 */
function removeRow(id){
$("#bootstrap-sub-table-estimateChild").bootstrapTable('remove', {
field: 'id',
values: id
})
}
$("input[name='pricingDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
//计算金额
function getTotalAmount() {
// 获取表格数据
const data = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData', true);
// 初始化汇总对象,减少代码重复并提高清晰度
const sums = {
enterprise: "", // 用于拼接物料名称和数量
enterpriseSum: 0, // 物料总数量
currencies: {
noRmb: { total: 0, single: 0 }, // 非人民币数量与总金额
rmb: { total: 0, single: 0 }, // 人民币
noUsd: { total: 0, single: 0 }, // 非美元
usd: { total: 0, single: 0 } // 美元
}
};
// 遍历数据进行计算
for (let i = 0; i < data.length; i++) {
const item = data[i];
// 拼接物料信息
sums.enterprise += "" + item.materialName + ": 数量 : " + item.materialNum;
sums.enterpriseSum += parseFloat(item.materialNum); // 累加物料数量
// 分别累加各货币的单个金额和总金额
['noRmb', 'rmb', 'noUsd', 'usd'].forEach(currency => {
sums.currencies[currency].single += parseFloat(item['material' + [currency] ]);
sums.currencies[currency].total += parseFloat(item['material' + [currency] + 'Sum']);
});
}
updateFormValues(sums);
}
function updateFormValues(sums) {
// 物料合计与数量合计没有在sums中直接给出,这里假设它们需要单独处理或已存在于页面其他部分
$("#enterprise_edit").val(sums.enterprise);
$("#enterpriseSum_edit").val(sums.enterpriseSum);
// 更新不含税单价和总价
$("#noRmb_edit").val(sums.currencies.noRmb.single);
$("#noRmbSum_edit").val(sums.currencies.noRmb.total);
$("#rmb_edit").val(sums.currencies.rmb.single);
$("#rmbSum_edit").val(sums.currencies.rmb.total);
$("#noUsd_edit").val(sums.currencies.noUsd.single);
$("#noUsdSum_edit").val(sums.currencies.noUsd.total);
$("#usd_edit").val(sums.currencies.usd.single);
$("#usdSum_edit").val(sums.currencies.usd.total);
}
$(document).ready(function() {
// 监听货币选项变化
$("#commonCurrency_edit").on("change", function() {
var isEditable = $(this).val() === "1";
var fieldName = "";
var materialColumnCells = $('#bootstrap-sub-table-estimateChild tbody tr td [field=" '+ fieldName+' "]');
// 根据是否可编辑,添加或移除xEditable
materialColumnCells.each(function() {
var cell = $(this);
var currentValue = cell.text().trim(); // 获取当前单元格的值
if (isEditable) {
// 如果允许编辑且尚未添加xEditable
if (!cell.hasClass('editable')) {
cell.addClass('editable'); // 添加标记类,以便跟踪状态
cell.editable({
type: 'text',
pk: cell.closest('tr').data('id'), // 假设每行有唯一ID
title: '物料的数量',
validate: function(value) {
if (!value) return '金额不能为空';
if (isNaN(value)) return '金额必须为数字';
return true;
},
success: function(response, newValue) {
// 成功后的回调,这里可以根据需要处理服务器响应
}
});
}
} else {
// 如果不允许编辑且已添加了xEditable
if (cell.hasClass('editable')) {
cell.removeClass('editable');
// 这里简化处理,实际中可能需要更复杂的逻辑来销毁xEditable实例
cell.off('.editable'); // 移除xEditable绑定的事件
cell.text(currentValue); // 还原原始文本
}
}
});
});
// 初始化时触发一次,根据默认状态设置可编辑性
$("#commonCurrency_edit").trigger("change");
});
function submitHandler() {
if ($.validate.form()) {
var formData = $("#form-salesEstimate-edit").serializeArray();
var tableData = $("#bootstrap-sub-table-estimateChild").bootstrapTable('getData');
console.log("tableData", JSON.stringify(tableData));
var rows = tableData.length;
if (rows == 0) {
$.modal.alertWarning("子表数据不能为空!");
} else {
formData.push({"name": "sysSalesEstimateChildList", "value": tableData});
var jsonData = $.common.formDataToJson(formData);
$.operate.saveJson(prefix + "/add", jsonData);
}
}
}
$("input[name='applyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

155
ruoyi-admin/src/main/resources/templates/sales/salesEstimate/salesEstimate.html

@ -1,155 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('销售估价列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>估价单号:</label>
<input type="text" name="aftersalesEstimateCode"/>
</li>
<li>
<label>估价状态:</label>
<select name="estimateStatus" th:with="type=${@dict.getType('estimate_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户名称:</label>
<input type="text" name="enterpriseName"/>
</li>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
</li>
<li>
<label>物料名称:</label>
<input type="text" name="materialName"/>
</li>
<li class="select-time">
<label>录入时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endCreateTime]"/>
</li>
<li>
<label>业务员:</label>
<select name="createBy">
<option value="">所有</option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="sales:salesEstimate:add">
<i class="fa fa-plus"></i> 添加
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('sales:salesEstimate:edit')}]];
var removeFlag = [[${@permission.hasPermi('sales:salesEstimate:remove')}]];
var cancelFlag = [[${@permission.hasPermi('sales:salesEstimate:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('sales:salesEstimate:restore')}]];
var estimateStatusDatas = [[${@dict.getType('estimate_status')}]];
var prefix = ctx + "sales/salesEstimate";
var userName = [[${@permission.getPrincipalProperty('userName')}]];
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
cancelUrl: prefix + "/cancel/{id}",
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
modalName: "销售估价",
pageList: [5, 10, 25, 50],
pageSize: 10,
sortable: true, // 是否启用排序
sortStable: true, // 设置为 true 将获得稳定的排序
detailView: false,
fixedColumns: true, // 启用冻结列
rightFixedColumns:1,
fixedRightNumber: 1, // 冻结右列个数
height: $(window).height() - 100,
columns: [
{checkbox: true},
{title: '销售估价ID',field: 'aftersalesEstimateId',visible: false},
{title: '估价单号',field: 'aftersalesEstimateCode',},
{title: '估价状态',field: 'estimateStatus',
formatter: function(value, row, index) {return $.table.selectDictLabel(estimateStatusDatas, value);}
},
{title: '客户代码',field: 'enterpriseCode',},
{title: '客户名称',field: 'enterpriseName',},
{title: '料号',field: 'materialNo',},
{title: '物料名称',field: 'materialName',},
{title: '物料合计',field: 'materialSum',},
{title: '数量合计',field: 'quantitySum',},
{title: '估价币种',field: 'estimateCurrencies',},
{title: '不含税总价(RMB)',field: 'allPriceExcludingNoTaxRmb',},
{title: '含税总价(RMB)',field: 'allPriceIncludesTaxRmb',},
{title: '不含税总价(美元)',field: 'allPriceExcludingNoTaxDollar',},
{title: '含税总价(美元)',field: 'allPriceExcludingTaxDollar',},
{title: '业务员',field: 'createBy',},
{title: '录入时间',field: 'createTime',},
{title: '更新人',field: 'updateBy',},
{title: '操作',align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.aftersalesEstimateId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.aftersalesEstimateId + '\')"><i class="fa fa-remove"></i>详情</a> ');
return actions.join('');
}
}
]
};
$.table.init(options);
$.ajax({
url: ctx + 'system/salesOrder/getBinessMembers',
type: 'get',
success: function (res) {
console.log(res)
if (res.rows.length > 0) {
var usertData = res.rows;
for (let i in usertData) {
$("select[name='createBy']").append(
"<option value='" + usertData[i].loginName + "'>" + usertData[i].userName + "</option>");
}
} else {
$.modal.msgError(res.msg);
}
}
});
});
</script>
</body>
</html>
Loading…
Cancel
Save