This commit is contained in:
xd 2024-03-06 17:40:25 +08:00
commit 9ae6849a83
26 changed files with 1180 additions and 213 deletions

View File

@ -0,0 +1,33 @@
package com.ruoyi.web.Utils;
import java.security.MessageDigest;
public class SHA1 {
/**
* @Comment SHA1实现
* @Author Ron
* @Date 2017年9月13日 下午3:30:36
* @return
*/
public static String shaEncode(String inStr){
MessageDigest sha = null;
try {
sha = MessageDigest.getInstance("SHA");
byte[] byteArray = inStr.getBytes("UTF-8");
byte[] md5Bytes = sha.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
} catch (Exception e) {
System.out.println(e.toString());
e.printStackTrace();
return "";
}
}
}

View File

@ -0,0 +1,57 @@
package com.ruoyi.web.controller.quote;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.quote.domain.MaterialDto;
import com.ruoyi.quote.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import static com.ruoyi.common.utils.PageUtils.startPage;
/**
* @ClassName QuoteController
* @Description TODO
* @Author JIAL
* @Date 2024/3/5 12:57
* @Version 1.0
*/
@RestController
@RequestMapping("/quote")
@DataSource(DataSourceType.QUOT)
public class QuoteController extends BaseController {
@Autowired
QuoteService quoteService;
@PostMapping("/materialList")
public TableDataInfo queryMaterialListByParam(@RequestParam("precMaterialName") String precMaterialName,
@RequestParam("vagueMaterialName") String vagueMaterialName,
@RequestParam("vagueModel") String vagueModel) {
startPage();
logger.info(precMaterialName + vagueMaterialName + vagueModel);
List<MaterialDto> materialDtos = quoteService.queryMaterialListByParam(precMaterialName,
vagueMaterialName, vagueModel);
System.out.println("打通接口");
return getDataTable(materialDtos);
}
@PostMapping("/redBPrice")
public void queryRedBookPriceByParam(@RequestBody List<CalculateRBParamDto> params) {
System.out.println(params.get(0).getModel());
System.out.println(params.get(0).getSpecification());
System.out.println(params.get(0).getVoltLevel());
}
}

View File

@ -14,12 +14,16 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.NoPswLoginBody; import com.ruoyi.common.core.domain.model.NoPswLoginBody;
import com.ruoyi.framework.web.service.SsoLoginService; import com.ruoyi.framework.web.service.SsoLoginService;
import com.ruoyi.web.Utils.SHA1;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.security.MessageDigest;
/** /**
* 第三方登录验证 * 第三方登录验证
* *
@ -27,6 +31,10 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
public class SsoLoginController { public class SsoLoginController {
@Value("${OA.KEY}")
private String key;
/** /**
* @Description: 平台带着token来系统里面登陆 * @Description: 平台带着token来系统里面登陆
* 这边需要做两个步骤 * 这边需要做两个步骤
@ -43,14 +51,18 @@ public class SsoLoginController {
@PostMapping("/noPwdLogin") @PostMapping("/noPwdLogin")
@ApiOperation(value = "无密码登录") @ApiOperation(value = "无密码登录")
public AjaxResult noPwdLogin(@RequestBody NoPswLoginBody noPswLoginBody) { public AjaxResult noPwdLogin(@RequestBody NoPswLoginBody noPswLoginBody) {
// 生成令牌(免密登录)
AjaxResult ajax = AjaxResult.success();
String loginid = noPswLoginBody.getLoginid(); String loginid = noPswLoginBody.getLoginid();
String token = noPswLoginBody.getToken(); String token = noPswLoginBody.getToken();
//OA验证 //OA验证
//.... String newToken = SHA1.shaEncode(key+loginid);
if(!token.equals(newToken)){
return ajax.error("访问异常!");
}
// 生成令牌(免密登录)
AjaxResult ajax = AjaxResult.success();
// 生成令牌 // 生成令牌
String systoken = loginService.noPwdLogin(loginid); String systoken = loginService.noPwdLogin(loginid);
ajax.put(Constants.TOKEN, systoken); ajax.put(Constants.TOKEN, systoken);

View File

@ -13,10 +13,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.cost; import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material; import com.ruoyi.system.domain.material;
import com.ruoyi.system.domain.temp;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.ruoyi.web.Utils.batchInsert;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;

View File

@ -198,3 +198,7 @@ minio:
accessKey: minioadmin accessKey: minioadmin
secretKey: minioadmin secretKey: minioadmin
bucketName: test bucketName: test
# OA单点登录key
OA:
KEY: uy4MbH

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="/home/ruoyi/logs" /> <property name="log.path" value="D:/ruoyi/logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
@ -11,7 +11,7 @@
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统日志输出 --> <!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file> <file>${log.path}/sys-info.log</file>
@ -34,7 +34,7 @@
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file> <file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
@ -56,7 +56,7 @@
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<!-- 用户访问日志输出 --> <!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file> <file>${log.path}/sys-user.log</file>
@ -70,7 +70,7 @@
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统模块日志级别控制 --> <!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" /> <logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 --> <!-- Spring日志级别控制 -->
@ -79,15 +79,15 @@
<root level="info"> <root level="info">
<appender-ref ref="console" /> <appender-ref ref="console" />
</root> </root>
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info" /> <appender-ref ref="file_info" />
<appender-ref ref="file_error" /> <appender-ref ref="file_error" />
</root> </root>
<!--系统用户操作日志--> <!--系统用户操作日志-->
<logger name="sys-user" level="info"> <logger name="sys-user" level="info">
<appender-ref ref="sys-user"/> <appender-ref ref="sys-user"/>
</logger> </logger>
</configuration> </configuration>

View File

@ -6,7 +6,7 @@ import com.alibaba.druid.pool.DruidDataSource;
/** /**
* druid 配置属性 * druid 配置属性
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
@ -61,13 +61,16 @@ public class DruidProperties
/** 配置获取连接等待超时的时间 */ /** 配置获取连接等待超时的时间 */
datasource.setMaxWait(maxWait); datasource.setMaxWait(maxWait);
/** 配置驱动连接超时时间,检测数据库建立连接的超时时间,单位是毫秒 */ /** 配置驱动连接超时时间,检测数据库建立连接的超时时间,单位是毫秒 */
datasource.setConnectTimeout(connectTimeout); datasource.setConnectTimeout(connectTimeout);
/** 配置网络超时时间,等待数据库操作完成的网络超时时间,单位是毫秒 */ /** 配置网络超时时间,等待数据库操作完成的网络超时时间,单位是毫秒 */
datasource.setSocketTimeout(socketTimeout); datasource.setSocketTimeout(socketTimeout);
/*
datasource.setConnectionProperties("connectTimeout="+connectTimeout+";socketTimeout="+socketTimeout);
*/
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */ /** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */ /** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */

View File

@ -32,6 +32,10 @@ public class CYlMaterial extends BaseEntity
@Excel(name = "单价") @Excel(name = "单价")
private BigDecimal materialPrice; private BigDecimal materialPrice;
/** 停用状态 */
@Excel(name = "停用状态")
private String materialState;
public void setMaterialId(Long materialId) public void setMaterialId(Long materialId)
{ {
this.materialId = materialId; this.materialId = materialId;
@ -69,6 +73,14 @@ public class CYlMaterial extends BaseEntity
return materialPrice; return materialPrice;
} }
public String getMaterialState() {
return materialState;
}
public void setMaterialState(String materialState) {
this.materialState = materialState;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -43,6 +43,10 @@ public class CMaterial extends BaseEntity
@Excel(name = "物料类型") @Excel(name = "物料类型")
private String typeName; private String typeName;
/** 物料状态 */
@Excel(name = "物料状态")
private String materialState;
/** 物料成本信息 */ /** 物料成本信息 */
private List<CMaterialCost> cMaterialCostList; private List<CMaterialCost> cMaterialCostList;
@ -119,6 +123,10 @@ public class CMaterial extends BaseEntity
this.typeName = typeName; this.typeName = typeName;
} }
public String getMaterialState() {return materialState;}
public void setMaterialState(String materialState) {this.materialState = materialState;}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -27,6 +27,10 @@ public class CMaterialType extends BaseEntity
@Excel(name = "名称") @Excel(name = "名称")
private String typeName; private String typeName;
/** 状态 */
@Excel(name = "状态")
private String typeState;
public void setTypeId(Long typeId) public void setTypeId(Long typeId)
{ {
this.typeId = typeId; this.typeId = typeId;
@ -55,6 +59,10 @@ public class CMaterialType extends BaseEntity
return typeName; return typeName;
} }
public String getTypeState() {return typeState;}
public void setTypeState(String typeState) {this.typeState = typeState;}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,40 @@
package com.ruoyi.quote.domain;
/**
* @title CalculateRBParamDto
* @description 用于接受前端传过来的型号规格参数
* @author JIAL
* @updateTime 2024/3/6 15:18
*/
public class CalculateRBParamDto {
private String model;
private String specification;
private String voltLevel;
public String getVoltLevel() {
return voltLevel;
}
public void setVoltLevel(String voltLevel) {
this.voltLevel = voltLevel;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
// 省略构造函数getter和setter
}

View File

@ -0,0 +1,149 @@
package com.ruoyi.quote.domain;
import com.ruoyi.common.core.domain.BaseEntity;
public class MaterialDto extends BaseEntity {
private String uid; //物料uid
private String prodCategory; //产品大类
private String prodWorkshop; //生产车间
private String model; //型号
private String specification; //规格
private String voltLevel; //电压等级
private String measureUnit; //单位
private double matCostPrice = 0; //材料成本价格
private double redBookPrice = 0; //红本价格
private double redBookCost = 0; //红本成本
public double getMatCostPrice() {
return matCostPrice;
}
public void setMatCostPrice(double matCostPrice) {
this.matCostPrice = matCostPrice;
}
public double getRedBookPrice() {
return redBookPrice;
}
public void setRedBookPrice(double redBookPrice) {
this.redBookPrice = redBookPrice;
}
public double getRedBookCost() {
return redBookCost;
}
public void setRedBookCost(double redBookCost) {
this.redBookCost = redBookCost;
}
public double getRbFacPrice() {
return rbFacPrice;
}
public void setRbFacPrice(double rbFacPrice) {
this.rbFacPrice = rbFacPrice;
}
private double rbFacPrice = 0; //红本厂价
private String manuCost; //制造成本
private String wdFSurcharge; //盘具点数
private Integer number = 1;
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getProdCategory() {
return prodCategory;
}
public void setProdCategory(String prodCategory) {
this.prodCategory = prodCategory;
}
public String getProdWorkshop() {
return prodWorkshop;
}
public void setProdWorkshop(String prodWorkshop) {
this.prodWorkshop = prodWorkshop;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getVoltLevel() {
return voltLevel;
}
public void setVoltLevel(String voltLevel) {
this.voltLevel = voltLevel;
}
public String getMeasureUnit() {
return measureUnit;
}
public void setMeasureUnit(String measureUnit) {
this.measureUnit = measureUnit;
}
public String getManuCost() {
return manuCost;
}
public void setManuCost(String manuCost) {
this.manuCost = manuCost;
}
public String getWdFSurcharge() {
return wdFSurcharge;
}
public void setWdFSurcharge(String wdFSurcharge) {
this.wdFSurcharge = wdFSurcharge;
}
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.quote.mapper;
import com.ruoyi.quote.domain.MaterialDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @ClassName QuoteMapper
* @Description TODO
* @Author JIAL
* @Date 2024/3/5 16:07
* @Version 1.0
*/
public interface QuoteMapper {
List<MaterialDto> selectMaterialListByParam(@Param("precMaterialName") String precMaterialName,
@Param("vagueMaterialName")String vagueMaterialName,
@Param("vagueModel") String vagueModel);
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.quote.service;
import com.ruoyi.quote.domain.MaterialDto;
import java.util.List;
/**
* @ClassName QuoteService
* @Description TODO
* @Author JIAL
* @Date 2024/3/5 16:06
* @Version 1.0
*/
public interface QuoteService {
List<MaterialDto> queryMaterialListByParam(String precMaterialName, String vagueMaterialName, String vagueModel);
}

View File

@ -0,0 +1,37 @@
package com.ruoyi.quote.service.impl;
import com.ruoyi.quote.domain.MaterialDto;
import com.ruoyi.quote.mapper.QuoteMapper;
import com.ruoyi.quote.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @ClassName QuoteServiceImpl
* @Description TODO
* @Author JIAL
* @Date 2024/3/5 16:07
* @Version 1.0
*/
@Service
public class QuoteServiceImpl implements QuoteService {
@Autowired
QuoteMapper quoteMapper;
/**
* @title queryMaterialListByParam
* @description 根据条件查询物料信息
* @author JIAL
* @param: precMaterialName
* @param: vagueMaterialName
* @param: vagueModel
* @updateTime 2024/3/5 16:16
* @return: java.util.List<com.ruoyi.quote.domain.MaterialDto>
*/
public List<MaterialDto> queryMaterialListByParam(String precMaterialName, String vagueMaterialName, String vagueModel) {
return quoteMapper.selectMaterialListByParam(precMaterialName, vagueMaterialName, vagueModel);
}
}

View File

@ -9,10 +9,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialNo" column="material_no" /> <result property="materialNo" column="material_no" />
<result property="materialName" column="material_name" /> <result property="materialName" column="material_name" />
<result property="materialPrice" column="material_price" /> <result property="materialPrice" column="material_price" />
<result property="materialState" column="material_state" />
</resultMap> </resultMap>
<sql id="selectCYlMaterialVo"> <sql id="selectCYlMaterialVo">
select material_id, material_no, material_name, material_price from c_yl_material select material_id, material_no, material_name, material_price, material_state from c_yl_material
</sql> </sql>
<select id="selectCYlMaterialList" parameterType="CYlMaterial" resultMap="CYlMaterialResult"> <select id="selectCYlMaterialList" parameterType="CYlMaterial" resultMap="CYlMaterialResult">
@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</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="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialState != null and materialState != ''"> and material_state = #{materialState}</if>
</where> </where>
</select> </select>
@ -34,11 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null and materialNo != ''">material_no,</if> <if test="materialNo != null and materialNo != ''">material_no,</if>
<if test="materialName != null and materialName != ''">material_name,</if> <if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialPrice != null">material_price,</if> <if test="materialPrice != null">material_price,</if>
<if test="materialState != null">material_state,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialNo != null and materialNo != ''">#{materialNo},</if> <if test="materialNo != null and materialNo != ''">#{materialNo},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if> <if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="materialPrice != null">#{materialPrice},</if> <if test="materialPrice != null">#{materialPrice},</if>
<if test="materialState != null">#{materialState},</if>
</trim> </trim>
</insert> </insert>
@ -48,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialNo != null and materialNo != ''">material_no = #{materialNo},</if> <if test="materialNo != null and materialNo != ''">material_no = #{materialNo},</if>
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if> <if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
<if test="materialPrice != null">material_price = #{materialPrice},</if> <if test="materialPrice != null">material_price = #{materialPrice},</if>
<if test="materialState != null">material_state = #{materialState},</if>
</trim> </trim>
where material_id = #{materialId} where material_id = #{materialId}
</update> </update>

View File

@ -46,10 +46,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectCFactoryByFactoryId" parameterType="Long" resultMap="CFactoryCMaterialTypeResult"> <select id="selectCFactoryByFactoryId" parameterType="Long" resultMap="CFactoryCMaterialTypeResult">
select a.factory_id, a.factory_no, a.factory_name, a.factory_rg_ratio, a.factory_wj_ratio, a.factory_fl_ratio, a.factory_df_ratio, a.factory_trq_ratio, a.factory_ys_ratio, a.factory_pj_ratio, a.factory_total_ratio, select a.factory_id, a.factory_no, a.factory_name, a.factory_rg_ratio, a.factory_wj_ratio, a.factory_fl_ratio,
b.type_id as sub_type_id, b.type_no as sub_type_no, b.type_name as sub_type_name, b.factory_id as sub_factory_id a.factory_df_ratio, a.factory_trq_ratio, a.factory_ys_ratio, a.factory_pj_ratio, a.factory_total_ratio,
b.type_id as sub_type_id, case when c.type_state!='0' then '' else b.type_no end sub_type_no,
case when c.type_state!='0' then b.type_name+'(停用)' else b.type_name end sub_type_name, b.factory_id as sub_factory_id
from c_factory a from c_factory a
left join c_material_type_factory b on b.factory_id = a.factory_no left join c_material_type_factory b on b.factory_id = a.factory_no
left join c_material_type c on c.type_no = b.type_no
where a.factory_id = #{factoryId} where a.factory_id = #{factoryId}
</select> </select>

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialDiany" column="material_diany" /> <result property="materialDiany" column="material_diany" />
<result property="materialDw" column="material_dw" /> <result property="materialDw" column="material_dw" />
<result property="typeName" column="type_name" /> <result property="typeName" column="type_name" />
<result property="materialState" column="material_state" />
</resultMap> </resultMap>
<resultMap id="CMaterialCMaterialCostResult" type="CMaterial" extends="CMaterialResult"> <resultMap id="CMaterialCMaterialCostResult" type="CMaterial" extends="CMaterialResult">
@ -30,7 +31,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectCMaterialVo"> <sql id="selectCMaterialVo">
select a.material_id,a.material_type_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,b.type_name select a.material_id,a.material_type_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,
case when b.type_state != '0' then b.type_name+'(停用)' else b.type_name end type_name,
a.material_state
from c_material a from c_material a
left join c_material_type b on a.material_type_id = b.type_no left join c_material_type b on a.material_type_id = b.type_no
</sql> </sql>
@ -41,16 +44,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialXingh != null and materialXingh != ''"> and material_xingh like concat('%', #{materialXingh}, '%')</if> <if test="materialXingh != null and materialXingh != ''"> and material_xingh like concat('%', #{materialXingh}, '%')</if>
<if test="materialGuig != null and materialGuig != ''"> and material_guig like concat('%', #{materialGuig}, '%')</if> <if test="materialGuig != null and materialGuig != ''"> and material_guig like concat('%', #{materialGuig}, '%')</if>
<if test="materialDiany != null and materialDiany != ''"> and material_diany like concat('%', #{materialDiany}, '%')</if> <if test="materialDiany != null and materialDiany != ''"> and material_diany like concat('%', #{materialDiany}, '%')</if>
<if test="materialState != null and materialState != ''"> and material_state = #{materialState}</if>
</where> </where>
</select> </select>
<select id="selectCMaterialByMaterialId" parameterType="Long" resultMap="CMaterialCMaterialCostResult"> <select id="selectCMaterialByMaterialId" parameterType="Long" resultMap="CMaterialCMaterialCostResult">
select a.material_id, a.material_type_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw, select a.material_id, case when d.type_state != '0' then '' else a.material_type_id end material_type_id,
b.cost_id as sub_cost_id, b.cost_material_id as sub_cost_material_id, b.cost_cl_id as sub_cost_cl_id, a.material_xingh, a.material_guig, a.material_diany, a.material_dw,a.material_state,
b.cost_cl_qty as sub_cost_cl_qty, b.cost_cl_qty_2 as sub_cost_cl_qty_2, b.cost_id as sub_cost_id, b.cost_material_id as sub_cost_material_id,
c.material_price as sub_material_price,c.material_name as sub_material_name case when c.material_state!='0' then '' else b.cost_cl_id end sub_cost_cl_id,
case when c.material_state!='0' then 0 else b.cost_cl_qty end sub_cost_cl_qty,
case when c.material_state!='0' then 0 else b.cost_cl_qty_2 end sub_cost_cl_qty_2,
case when c.material_state!='0' then 0 else c.material_price end sub_material_price,
c.material_name as sub_material_name
from c_material a from c_material a
left join c_material_cost b on b.cost_material_id = a.material_id left join c_material_cost b on b.cost_material_id = a.material_id
left join c_material_type d on d.type_no = a.material_type_id
left join c_yl_material c on c.material_no = b.cost_cl_id left join c_yl_material c on c.material_no = b.cost_cl_id
where a.material_id = #{materialId} where a.material_id = #{materialId}
ORDER BY c.material_no ASC ORDER BY c.material_no ASC
@ -64,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialGuig != null and materialGuig != ''">material_guig,</if> <if test="materialGuig != null and materialGuig != ''">material_guig,</if>
<if test="materialDiany != null">material_diany,</if> <if test="materialDiany != null">material_diany,</if>
<if test="materialDw != null">material_dw,</if> <if test="materialDw != null">material_dw,</if>
<if test="materialState != null">material_state,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialTypeId != null and materialTypeId != ''">#{materialTypeId},</if> <if test="materialTypeId != null and materialTypeId != ''">#{materialTypeId},</if>
@ -71,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialGuig != null and materialGuig != ''">#{materialGuig},</if> <if test="materialGuig != null and materialGuig != ''">#{materialGuig},</if>
<if test="materialDiany != null">#{materialDiany},</if> <if test="materialDiany != null">#{materialDiany},</if>
<if test="materialDw != null">#{materialDw},</if> <if test="materialDw != null">#{materialDw},</if>
<if test="materialState != null">#{materialState},</if>
</trim> </trim>
</insert> </insert>
@ -82,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialGuig != null and materialGuig != ''">material_guig = #{materialGuig},</if> <if test="materialGuig != null and materialGuig != ''">material_guig = #{materialGuig},</if>
<if test="materialDiany != null">material_diany = #{materialDiany},</if> <if test="materialDiany != null">material_diany = #{materialDiany},</if>
<if test="materialDw != null">material_dw = #{materialDw},</if> <if test="materialDw != null">material_dw = #{materialDw},</if>
<if test="materialState != null">material_state = #{materialState},</if>
</trim> </trim>
where material_id = #{materialId} where material_id = #{materialId}
</update> </update>

View File

@ -8,10 +8,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="typeId" column="type_id" /> <result property="typeId" column="type_id" />
<result property="typeNo" column="type_no" /> <result property="typeNo" column="type_no" />
<result property="typeName" column="type_name" /> <result property="typeName" column="type_name" />
<result property="typeState" column="type_state" />
</resultMap> </resultMap>
<sql id="selectCMaterialTypeVo"> <sql id="selectCMaterialTypeVo">
select type_id, type_no, type_name from c_material_type select type_id, type_no, type_name, type_state from c_material_type
</sql> </sql>
<select id="selectCMaterialTypeList" parameterType="CMaterialType" resultMap="CMaterialTypeResult"> <select id="selectCMaterialTypeList" parameterType="CMaterialType" resultMap="CMaterialTypeResult">
@ -19,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="typeNo != null and typeNo != ''"> and type_no = #{typeNo}</if> <if test="typeNo != null and typeNo != ''"> and type_no = #{typeNo}</if>
<if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if> <if test="typeName != null and typeName != ''"> and type_name like concat('%', #{typeName}, '%')</if>
<if test="typeState != null and typeState != ''"> and type_state = #{typeState}</if>
</where> </where>
order by type_no asc order by type_no asc
</select> </select>
@ -33,10 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="typeNo != null and typeNo != ''">type_no,</if> <if test="typeNo != null and typeNo != ''">type_no,</if>
<if test="typeName != null and typeName != ''">type_name,</if> <if test="typeName != null and typeName != ''">type_name,</if>
<if test="typeState != null and typeState != ''">type_state,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="typeNo != null and typeNo != ''">#{typeNo},</if> <if test="typeNo != null and typeNo != ''">#{typeNo},</if>
<if test="typeName != null and typeName != ''">#{typeName},</if> <if test="typeName != null and typeName != ''">#{typeName},</if>
<if test="typeState != null and typeState != ''">#{typeState},</if>
</trim> </trim>
</insert> </insert>
@ -45,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="typeNo != null and typeNo != ''">type_no = #{typeNo},</if> <if test="typeNo != null and typeNo != ''">type_no = #{typeNo},</if>
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if> <if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="typeState != null and typeState != ''">type_state = #{typeState},</if>
</trim> </trim>
where type_id = #{typeId} where type_id = #{typeId}
</update> </update>

View File

@ -0,0 +1,44 @@
<?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.quote.mapper.QuoteMapper">
<resultMap type="MaterialDto" id="MaterialResult">
<result property="uid" column="uid" />
<result property="model" column="model" />
<result property="specification" column="specification" />
<result property="voltLevel" column="voltLevel" />
<result property="measureUnit" column="measureUnit" />
<result property="prodCategory" column="prodCategory" />
<result property="matCostPrice" column="matCostPrice" />
<result property="manuCost" column="manuCost" />
<result property="wdFSurcharge" column="wdFSurcharge" />
<result property="redBookPrice" column="redBookPrice" />
<result property="rbFacPrice" column="rbFacPrice" />
<result property="redBookCost" column="redBookCost" />
</resultMap>
<select id="selectMaterialListByParam" resultType="com.ruoyi.quote.domain.MaterialDto">
select a.material_id AS uid,a.material_xingh AS model,a.material_guig AS specification,
a.material_diany AS voltLevel,a.material_dw AS measureUnit,c.type_name As prodCategory,
b.price matCostPrice, d.factory_total_ratio/100 manuCost,d.factory_pj_ratio/100 wdFSurcharge
from c_material a
left join
(select a.cost_material_id,sum((isnull(a.cost_cl_qty,0)+isnull(a.cost_cl_qty_2,0))*b.material_price) price
from c_material_cost a
left join c_yl_material b on a.cost_cl_id=b.material_no
group by a.cost_material_id
)b on a.material_id=b.cost_material_id
left join c_material_type_factory c on a.material_type_id = c.type_no
left join c_factory d on d.factory_no = c.factory_id
<where>
<if test="precMaterialName != null and precMaterialName != ''"> and a.material_xingh like concat('', #{precMaterialName}, '%')</if>
<if test="vagueMaterialName != null and vagueMaterialName != ''"> and a.material_xingh like concat('%', #{vagueMaterialName}, '%')</if>
<if test="vagueModel != null and vagueModel != ''"> and a.material_guig like concat('%', #{vagueModel}, '%')</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,17 @@
import request from '@/utils/request'
export function queryMaterialListByParam(query) {
return request({
url: '/quote/materialList',
method: 'post',
params: query
})
}
export function queryRedBookPriceByParam (query) {
return request({
url: '/quote/redBPrice',
method: 'post',
data: query
})
}

View File

@ -17,6 +17,16 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="materialState">
<el-select v-model="queryParams.materialState" placeholder="材料状态" clearable>
<el-option
v-for="dict in dict.type.yl_material_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -76,6 +86,11 @@
<el-table-column label="编码" align="center" prop="materialNo" /> <el-table-column label="编码" align="center" prop="materialNo" />
<el-table-column label="名称" align="center" prop="materialName" /> <el-table-column label="名称" align="center" prop="materialName" />
<el-table-column label="单价" align="center" prop="materialPrice" /> <el-table-column label="单价" align="center" prop="materialPrice" />
<el-table-column prop="materialState" label="状态" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.yl_material_state" :value="scope.row.materialState"/>
</template>
</el-table-column>
<el-table-column label="操作" width="250" align="center"> <el-table-column label="操作" width="250" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -116,6 +131,15 @@
<el-form-item label="单价" prop="materialPrice"> <el-form-item label="单价" prop="materialPrice">
<el-input v-model="form.materialPrice" placeholder="请输入单价" /> <el-input v-model="form.materialPrice" placeholder="请输入单价" />
</el-form-item> </el-form-item>
<el-form-item prop="materialState" label="停用状态" label-width="100px">
<el-radio-group v-model="form.materialState">
<el-radio
v-for="dict in dict.type.yl_material_state"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -130,6 +154,7 @@ import { listClMaterial, getClMaterial, delClMaterial, addClMaterial, updateClMa
export default { export default {
name: "ClMaterial", name: "ClMaterial",
dicts: ['yl_material_state'],
data() { data() {
return { return {
// //
@ -158,6 +183,7 @@ export default {
pageSize: 10, pageSize: 10,
materialNo: null, materialNo: null,
materialName: null, materialName: null,
materialState: null,
}, },
// //
form: {}, form: {},
@ -204,7 +230,8 @@ export default {
materialId: null, materialId: null,
materialNo: null, materialNo: null,
materialName: null, materialName: null,
materialPrice: null materialPrice: null,
materialState: "0"
}; };
this.resetForm("form"); this.resetForm("form");
}, },

View File

@ -69,19 +69,20 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table width="100%" v-loading="loading" :data="factoryList" @selection-change="handleSelectionChange"> <el-table width="100%" v-loading="loading" :data="factoryList" :row-class-name="rowFactoryIndex" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="id" align="center" prop="factoryId" v-if="false"/> <el-table-column label="id" align="center" prop="factoryId" v-if="false"/>
<el-table-column label="编码" width="100" align="center" prop="factoryNo" /> <el-table-column label="编码" width="100" align="center" prop="factoryNo" />
<el-table-column label="名称" width="100" align="center" prop="factoryName" /> <el-table-column label="名称" width="100" align="center" prop="factoryName" />
<el-table-column label="人工成本占比" width="150" align="center" prop="factoryRgRatio" /> <el-table-column label="人工成本占比(%)" width="150" align="center" prop="factoryRgRatio" />
<el-table-column label="五金费用占比" width="150" align="center" prop="factoryWjRatio" /> <el-table-column label="五金费用占比(%)" width="150" align="center" prop="factoryWjRatio" />
<el-table-column label="辅料费用占比" width="150" align="center" prop="factoryFlRatio" /> <el-table-column label="辅料费用占比(%)" width="150" align="center" prop="factoryFlRatio" />
<el-table-column label="电费占比" width="150" align="center" prop="factoryDfRatio" /> <el-table-column label="电费占比(%)" width="150" align="center" prop="factoryDfRatio" />
<el-table-column label="天然气费用占比" width="150" align="center" prop="factoryTrqRatio" /> <el-table-column label="天然气费用占比(%)" width="150" align="center" prop="factoryTrqRatio" />
<el-table-column label="运输费用占比" width="150" align="center" prop="factoryYsRatio" /> <el-table-column label="运输费用占比(%)" width="150" align="center" prop="factoryYsRatio" />
<el-table-column label="总占比" align="center" prop="factoryTotalRatio" /> <el-table-column label="总占比(%)" width="150" align="center" prop="factoryTotalRatio" />
<el-table-column label="盘具费用占比" width="150" align="center" prop="factoryPjRatio" /> <el-table-column label="盘具费用占比(%)" width="150" align="center" prop="factoryPjRatio" />
<el-table-column fixed="right" label="操作" align="center" width="150"> <el-table-column fixed="right" label="操作" align="center" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -115,60 +116,60 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="编码" prop="factoryNo" label-width="120px"> <el-form-item label="编码" prop="factoryNo" label-width="150px">
<el-input v-model="form.factoryNo" placeholder="请输入编码" :disabled="isDis"/> <el-input v-model="form.factoryNo" placeholder="请输入编码" :disabled="isDis"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="名称" prop="factoryName" label-width="120px"> <el-form-item label="名称" prop="factoryName" label-width="150px">
<el-input v-model="form.factoryName" placeholder="请输入名称" :disabled="isDis" /> <el-input v-model="form.factoryName" placeholder="请输入名称" :disabled="isDis" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="人工成本占比" prop="factoryRgRatio" label-width="120px"> <el-form-item label="人工成本占比(%)" prop="factoryRgRatio" label-width="150px">
<el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" @input="wat()"/> <el-input v-model="form.factoryRgRatio" placeholder="请输入人工成本占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="五金费用占比" prop="factoryWjRatio" label-width="120px"> <el-form-item label="五金费用占比(%)" prop="factoryWjRatio" label-width="150px">
<el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" @input="wat()"/> <el-input v-model="form.factoryWjRatio" placeholder="请输入五金费用占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="辅料费用占比" prop="factoryFlRatio" label-width="120px"> <el-form-item label="辅料费用占比(%)" prop="factoryFlRatio" label-width="150px">
<el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" @input="wat()"/> <el-input v-model="form.factoryFlRatio" placeholder="请输入辅料费用占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="电费占比" prop="factoryDfRatio" label-width="120px"> <el-form-item label="电费占比(%)" prop="factoryDfRatio" label-width="150px">
<el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" @input="wat()"/> <el-input v-model="form.factoryDfRatio" placeholder="请输入电费占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="天然气费用占比" prop="factoryTrqRatio" label-width="120px"> <el-form-item label="天然气费用占比(%)" prop="factoryTrqRatio" label-width="150px">
<el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" @input="wat()"/> <el-input v-model="form.factoryTrqRatio" placeholder="请输入天然气费用占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="运输费用占比" prop="factoryYsRatio" label-width="120px"> <el-form-item label="运输费用占比(%)" prop="factoryYsRatio" label-width="150px">
<el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" @input="wat()"/> <el-input v-model="form.factoryYsRatio" placeholder="请输入运输费用占比" @input="wat()"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="盘具费用占比" prop="factoryPjRatio" label-width="120px"> <el-form-item label="盘具费用占比(%)" prop="factoryPjRatio" label-width="150px">
<el-input v-model="form.factoryPjRatio" placeholder="请输入盘具费用占比" /> <el-input v-model="form.factoryPjRatio" placeholder="请输入盘具费用占比" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="总占比" prop="factoryYsRatio" label-width="120px"> <el-form-item label="总占比(%)" prop="factoryYsRatio" label-width="150px">
<el-input v-model="form.factoryTotalRatio" :disabled="true"/> <el-input v-model="form.factoryTotalRatio" :disabled="true"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -318,7 +319,6 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getMaterialType();
}, },
methods: { methods: {
/** 查询车间管理列表 */ /** 查询车间管理列表 */
@ -333,6 +333,7 @@ export default {
// //
getMaterialType(){ getMaterialType(){
this.queryParams.typeState='0';//
listMaterialType(this.queryParams).then(response => { listMaterialType(this.queryParams).then(response => {
this.cTypeList = response.cTypeList; this.cTypeList = response.cTypeList;
@ -389,6 +390,7 @@ export default {
this.open = true; this.open = true;
this.title = "添加车间管理"; this.title = "添加车间管理";
this.isDis = false; this.isDis = false;
this.getMaterialType();
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -400,6 +402,7 @@ export default {
this.open = true; this.open = true;
this.title = "修改车间管理"; this.title = "修改车间管理";
this.isDis = true; this.isDis = true;
this.getMaterialType();
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -484,6 +487,10 @@ export default {
var YsRatio = this.form.factoryYsRatio?parseFloat(this.form.factoryYsRatio):0; var YsRatio = this.form.factoryYsRatio?parseFloat(this.form.factoryYsRatio):0;
this.form.factoryTotalRatio = (RgRatio+WjRatio+FlRatio+DfRatio+TrqRatio+YsRatio).toFixed(3) this.form.factoryTotalRatio = (RgRatio+WjRatio+FlRatio+DfRatio+TrqRatio+YsRatio).toFixed(3)
},
/** 序号 */
rowFactoryIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
} }
} }
}; };

View File

@ -25,6 +25,16 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="materialState">
<el-select v-model="queryParams.materialState" placeholder="物料状态" clearable>
<el-option
v-for="dict in dict.type.material_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -86,6 +96,11 @@
<el-table-column label="规格" align="center" prop="materialGuig" /> <el-table-column label="规格" align="center" prop="materialGuig" />
<el-table-column label="电压" align="center" prop="materialDiany" /> <el-table-column label="电压" align="center" prop="materialDiany" />
<el-table-column label="单位" align="center" prop="materialDw" /> <el-table-column label="单位" align="center" prop="materialDw" />
<el-table-column prop="materialState" label="状态" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_state" :value="scope.row.materialState"/>
</template>
</el-table-column>
<el-table-column label="操作" width="250" align="center"> <el-table-column label="操作" width="250" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -130,6 +145,17 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item prop="materialState" label="停用状态" label-width="100px">
<el-radio-group v-model="form.materialState">
<el-radio
v-for="dict in dict.type.material_state"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@ -227,6 +253,7 @@ import { numAdd,numSub,numMulti,numDiv } from "@/utils/operation";
export default { export default {
name: "Material", name: "Material",
dicts: ['material_state'],
data() { data() {
return { return {
// //
@ -265,6 +292,7 @@ export default {
materialXingh: null, materialXingh: null,
materialGuig: null, materialGuig: null,
materialDiany: null, materialDiany: null,
materialState: null
}, },
// //
form: {}, form: {},
@ -290,8 +318,6 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getClMaterials();
this.getMaterialType();
}, },
computed:{ computed:{
@ -324,15 +350,16 @@ export default {
// //
getMaterialType(){ getMaterialType(){
this.queryParams.typeState='0';//
listMaterialType(this.queryParams).then(response => { listMaterialType(this.queryParams).then(response => {
this.cTypeList = response.cTypeList; this.cTypeList = response.cTypeList;
/*
let obj = {}; let obj = {};
this.cTypeList.forEach(item => { this.cTypeList.forEach(item => {
let key = item.typeNo; let key = item.typeNo;
obj[key] = item.typeName; obj[key] = item.typeName;
}) })
this.cTypeMap = obj; this.cTypeMap = obj;*/
}); });
}, },
@ -348,7 +375,8 @@ export default {
materialXingh: null, materialXingh: null,
materialGuig: null, materialGuig: null,
materialDiany: null, materialDiany: null,
materialDw: null materialDw: null,
materialState: 0
}; };
this.cMaterialCostList = []; this.cMaterialCostList = [];
this.resetForm("form"); this.resetForm("form");
@ -374,6 +402,8 @@ export default {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加物料管理"; this.title = "添加物料管理";
this.getClMaterials();
this.getMaterialType();
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -384,6 +414,8 @@ export default {
this.cMaterialCostList = response.data.cmaterialCostList; this.cMaterialCostList = response.data.cmaterialCostList;
this.open = true; this.open = true;
this.title = "修改物料管理"; this.title = "修改物料管理";
this.getClMaterials();
this.getMaterialType();
this.sumPriceTotal() this.sumPriceTotal()
}); });
}, },

View File

@ -17,6 +17,16 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="typeState">
<el-select v-model="queryParams.typeState" placeholder="类别状态" clearable>
<el-option
v-for="dict in dict.type.material_type_state"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -71,9 +81,15 @@
<el-table v-loading="loading" :data="materialTypeList" :row-class-name="rowCMaterialTypeIndex" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="materialTypeList" :row-class-name="rowCMaterialTypeIndex" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="id" align="center" prop="typeId" v-if="false"/> <el-table-column label="id" align="center" prop="typeId" v-if="false"/>
<el-table-column label="编码" align="center" prop="typeNo" /> <el-table-column label="编码" align="center" prop="typeNo" />
<el-table-column label="名称" align="center" prop="typeName" /> <el-table-column label="名称" align="center" prop="typeName" />
<el-table-column prop="typeState" label="状态" width="80">
<template slot-scope="scope">
<dict-tag :options="dict.type.material_type_state" :value="scope.row.typeState"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -111,6 +127,15 @@
<el-form-item label="名称" prop="typeName"> <el-form-item label="名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入名称" /> <el-input v-model="form.typeName" placeholder="请输入名称" />
</el-form-item> </el-form-item>
<el-form-item prop="typeState" label="停用状态" label-width="100px">
<el-radio-group v-model="form.typeState">
<el-radio
v-for="dict in dict.type.material_type_state"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -125,6 +150,7 @@ import { listMaterialType, getMaterialType, delMaterialType, addMaterialType, up
export default { export default {
name: "MaterialType", name: "MaterialType",
dicts: ['material_type_state'],
data() { data() {
return { return {
// //
@ -153,6 +179,7 @@ export default {
pageSize: 10, pageSize: 10,
typeNo: null, typeNo: null,
typeName: null, typeName: null,
typeState:null
}, },
// //
form: {}, form: {},

View File

@ -7,195 +7,220 @@
<template slot="title"> <template slot="title">
<div> <div>
<el-button style="margin-left: 20px" size="small" type="primary" >财务费用明细</el-button> <el-button style="margin-left: 20px" size="small" type="primary" >财务费用明细</el-button>
<el-button style="margin-left: 50px" size="small" type="primary" >恢复默认</el-button> <el-button style="margin-left: 50px" @click.native.stop.prevent="restoreDefaults" size="small" type="primary" >恢复默认</el-button>
</div> </div>
</template> </template>
<div class="form-box gray-background" style="margin-top: 5px; padding-top: 5px"> <div class="form-box gray-background" style="margin-top: 5px; padding-top: 5px">
<el-form label-width="150px" :model="formLabelAlign" :rules="formRules"> <el-form label-width="150px" :model="formLabelAlign" :rules="formRules">
<el-row> <el-row>
<el-col :span="6" > <el-col :span="6" :class="{ 'changed-field': formLabelAlign.officeExpense.fieldStatus }">
<el-form-item label="办公费" title="办公费" prop="officeExpense"> <el-form-item label="办公费" title="办公费" prop="officeExpense.value">
<el-input v-model="formLabelAlign.officeExpense" placeholder="办公费" > <el-input v-model="formLabelAlign.officeExpense.value" placeholder="办公费"
@blur="validateAndSetDefault(formLabelAlign, 'officeExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.travelExpense.fieldStatus }">
<el-form-item label="差旅费" title="差旅费" prop="travelExpense"> <el-form-item label="差旅费" title="差旅费" prop="travelExpense.value">
<el-input v-model="formLabelAlign.travelExpense" placeholder="差旅费"> <el-input v-model="formLabelAlign.travelExpense.value" placeholder="差旅费"
@blur="validateAndSetDefault(formLabelAlign, 'travelExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.salaryInsur.fieldStatus }">
<el-form-item label="工资及福利保险" title="工资及福利保险" prop="salaryInsur"> <el-form-item label="工资及福利保险" title="工资及福利保险" prop="salaryInsur.value">
<el-input v-model="formLabelAlign.salaryInsur" placeholder="工资及福利保险"> <el-input v-model="formLabelAlign.salaryInsur.value" placeholder="工资及福利保险"
@blur="validateAndSetDefault(formLabelAlign, 'salaryInsur')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.otherMgmtExpense.fieldStatus }">
<el-form-item label="其他管理费" title="其他管理费" prop="otherMgmtExpense"> <el-form-item label="其他管理费" title="其他管理费" prop="otherMgmtExpense.value">
<el-input v-model="formLabelAlign.otherMgmtExpense" placeholder="其他管理费"> <el-input v-model="formLabelAlign.otherMgmtExpense.value" placeholder="其他管理费"
@blur="validateAndSetDefault(formLabelAlign, 'otherMgmtExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.carExpense.fieldStatus }">
<el-form-item label="汽车费用" title="汽车费用" prop="carExpense"> <el-form-item label="汽车费用" title="汽车费用" prop="carExpense.value">
<el-input v-model="formLabelAlign.carExpense" placeholder="汽车费用"> <el-input v-model="formLabelAlign.carExpense.value" placeholder="汽车费用"
@blur="validateAndSetDefault(formLabelAlign, 'carExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col > </el-col >
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.mgmtBizEntFee.fieldStatus }">
<el-form-item label="管理-业务招待费" title="管理-业务招待费" prop="mgmtBizEntFee"> <el-form-item label="管理-业务招待费" title="管理-业务招待费" prop="mgmtBizEntFee.value">
<el-input v-model="formLabelAlign.mgmtBizEntFee" placeholder="管理-业务招待费"> <el-input v-model="formLabelAlign.mgmtBizEntFee.value" placeholder="管理-业务招待费"
@blur="validateAndSetDefault(formLabelAlign, 'mgmtBizEntFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.mgmtDeprecExpense.fieldStatus }">
<el-form-item label="管理-折旧费" title="管理-折旧费" prop="mgmtDeprecExpense"> <el-form-item label="管理-折旧费" title="管理-折旧费" prop="mgmtDeprecExpense.value"
<el-input v-model="formLabelAlign.mgmtDeprecExpense" placeholder="管理-折旧费"> @blur="validateAndSetDefault(formLabelAlign, 'mgmtDeprecExpense')">
<el-input v-model="formLabelAlign.mgmtDeprecExpense.value" placeholder="管理-折旧费">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.consultAuditFee.fieldStatus }">
<el-form-item label="咨询与审计费" title="咨询与审计费" prop="consultAuditFee"> <el-form-item label="咨询与审计费" title="咨询与审计费" prop="consultAuditFee.value"
<el-input v-model="formLabelAlign.consultAuditFee" placeholder="咨询与审计费"> @blur="validateAndSetDefault(formLabelAlign, 'consultAuditFee')">
<el-input v-model="formLabelAlign.consultAuditFee.value" placeholder="咨询与审计费">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.tenderCost.fieldStatus }">
<el-form-item label="标书费用" title="标书费用" prop="tenderCost"> <el-form-item label="标书费用" title="标书费用" prop="tenderCost.value">
<el-input v-model="formLabelAlign.tenderCost" placeholder="标书费用"> <el-input v-model="formLabelAlign.tenderCost.value" placeholder="标书费用"
@blur="validateAndSetDefault(formLabelAlign, 'tenderCost')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.rentExpense.fieldStatus }">
<el-form-item label="房租费" title="房租费" prop="rentExpense"> <el-form-item label="房租费" title="房租费" prop="rentExpense.value">
<el-input v-model="formLabelAlign.rentExpense" placeholder="房租费"> <el-input v-model="formLabelAlign.rentExpense.value" placeholder="房租费"
@blur="validateAndSetDefault(formLabelAlign, 'rentExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.salary.fieldStatus }">
<el-form-item label="工资" title="工资" prop="salary"> <el-form-item label="工资" title="工资" prop="salary.value">
<el-input v-model="formLabelAlign.salary" placeholder="工资"> <el-input v-model="formLabelAlign.salary.value" placeholder="工资"
@blur="validateAndSetDefault(formLabelAlign, 'salary')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.inspectFee.fieldStatus }">
<el-form-item label="检验检查费" prop="inspectFee"> <el-form-item label="检验检查费" prop="inspectFee.value">
<el-input v-model="formLabelAlign.inspectFee" placeholder="检验检查费"> <el-input v-model="formLabelAlign.inspectFee.value" placeholder="检验检查费"
@blur="validateAndSetDefault(formLabelAlign, 'inspectFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.transTravelExpense.fieldStatus }">
<el-form-item label="销售-交通与差旅费" title="交通与差旅费" prop="transTravelExpense"> <el-form-item label="销售-交通与差旅费" title="交通与差旅费" prop="transTravelExpense.value">
<el-input v-model="formLabelAlign.transTravelExpense" placeholder="交通与差旅费"> <el-input v-model="formLabelAlign.transTravelExpense.value" placeholder="交通与差旅费"
@blur="validateAndSetDefault(formLabelAlign, 'transTravelExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.otherSalesExpense.fieldStatus }">
<el-form-item label="其他销售费" title="其他销售费" prop="otherSalesExpense"> <el-form-item label="其他销售费" title="其他销售费" prop="otherSalesExpense.value">
<el-input v-model="formLabelAlign.otherSalesExpense" placeholder="其他销售费"> <el-input v-model="formLabelAlign.otherSalesExpense.value" placeholder="其他销售费"
@blur="validateAndSetDefault(formLabelAlign, 'otherSalesExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.biddingCost.fieldStatus }">
<el-form-item label="投标费用" title="投标费用" prop="biddingCost"> <el-form-item label="投标费用" title="投标费用" prop="biddingCost.value">
<el-input v-model="formLabelAlign.biddingCost" placeholder="投标费用"> <el-input v-model="formLabelAlign.biddingCost.value" placeholder="投标费用"
@blur="validateAndSetDefault(formLabelAlign, 'biddingCost')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.bizFee.fieldStatus }">
<el-form-item label="销售-业务费" title="销售-业务费" prop="bizFee"> <el-form-item label="销售-业务费" title="销售-业务费" prop="bizFee.value">
<el-input v-model="formLabelAlign.bizFee" placeholder="销售-业务费"> <el-input v-model="formLabelAlign.bizFee.value" placeholder="销售-业务费"
@blur="validateAndSetDefault(formLabelAlign, 'bizFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.salesBizEntFee.fieldStatus }">
<el-form-item label="销售-业务招待费" title="销售-业务招待费" prop="salesBizEntFee"> <el-form-item label="销售-业务招待费" title="销售-业务招待费" prop="salesBizEntFee.value">
<el-input v-model="formLabelAlign.salesBizEntFee" placeholder="销售-业务招待费"> <el-input v-model="formLabelAlign.salesBizEntFee.value" placeholder="销售-业务招待费"
@blur="validateAndSetDefault(formLabelAlign, 'salesBizEntFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.transpHandlingFee.fieldStatus }">
<el-form-item label="运输装卸费" title="运输装卸费" prop="transpHandlingFee"> <el-form-item label="运输装卸费" title="运输装卸费" prop="transpHandlingFee.value">
<el-input v-model="formLabelAlign.transpHandlingFee" placeholder="运输装卸费"> <el-input v-model="formLabelAlign.transpHandlingFee.value" placeholder="运输装卸费"
@blur="validateAndSetDefault(formLabelAlign, 'transpHandlingFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.manufDeprecExpense.fieldStatus }">
<el-form-item label="制造-折旧费" title="制造-折旧费" prop="manufDeprecExpense"> <el-form-item label="制造-折旧费" title="制造-折旧费" prop="manufDeprecExpense.value">
<el-input v-model="formLabelAlign.manufDeprecExpense" placeholder="制造-折旧费"> <el-input v-model="formLabelAlign.manufDeprecExpense.value" placeholder="制造-折旧费"
@blur="validateAndSetDefault(formLabelAlign, 'manufDeprecExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.interestExpense.fieldStatus }">
<el-form-item label="利息支出" title="利息支出" prop="interestExpense"> <el-form-item label="利息支出" title="利息支出" prop="interestExpense.value">
<el-input v-model="formLabelAlign.interestExpense" placeholder="利息支出"> <el-input v-model="formLabelAlign.interestExpense.value" placeholder="利息支出"
@blur="validateAndSetDefault(formLabelAlign, 'interestExpense')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.handlingFee.fieldStatus }">
<el-form-item label="手续费" title="手续费" prop="handlingFee"> <el-form-item label="手续费" title="手续费" prop="handlingFee.value">
<el-input v-model="formLabelAlign.handlingFee" placeholder="手续费"> <el-input v-model="formLabelAlign.handlingFee.value" placeholder="手续费"
@blur="validateAndSetDefault(formLabelAlign, 'handlingFee')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.discInterest.fieldStatus }">
<el-form-item label="贴现利息" title="贴现利息" prop="discInterest"> <el-form-item label="贴现利息" title="贴现利息" prop="discInterest.value">
<el-input v-model="formLabelAlign.discInterest" placeholder="贴现利息"> <el-input v-model="formLabelAlign.discInterest.value" placeholder="贴现利息"
@blur="validateAndSetDefault(formLabelAlign, 'discInterest')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.otherFinExpenses.fieldStatus }">
<el-form-item label="财务-其他费用" title="财务-其他费用" prop="otherFinExpenses"> <el-form-item label="财务-其他费用" title="财务-其他费用" prop="otherFinExpenses.value">
<el-input v-model="formLabelAlign.otherFinExpenses" placeholder="财务-其他费用"> <el-input v-model="formLabelAlign.otherFinExpenses.value" placeholder="财务-其他费用"
@blur="validateAndSetDefault(formLabelAlign, 'otherFinExpenses')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.invOpCost.fieldStatus }">
<el-form-item label="存货机会成本" title="存货机会成本" prop="invOpCost"> <el-form-item label="存货机会成本" title="存货机会成本" prop="invOpCost.value">
<el-input v-model="formLabelAlign.invOpCost" placeholder="存货机会成本"> <el-input v-model="formLabelAlign.invOpCost.value" placeholder="存货机会成本"
@blur="validateAndSetDefault(formLabelAlign, 'invOpCost')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="6"> <el-col :span="6" :class="{ 'changed-field': formLabelAlign.tax.fieldStatus }">
<el-form-item label="税金" title="税金" prop="tax"> <el-form-item label="税金" title="税金" prop="tax.value">
<el-input v-model="formLabelAlign.tax" placeholder="税金"> <el-input v-model="formLabelAlign.tax.value" placeholder="税金"
@blur="validateAndSetDefault(formLabelAlign, 'tax')">
<template slot="append">%</template> <template slot="append">%</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@ -248,14 +273,249 @@
</div> </div>
<!-- 添加物料和计算数据的按钮div --> <!-- 添加物料和计算数据的按钮div -->
<div class="button-box"> <div class="button-box">
<el-button type="text" >添加物料</el-button> <el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text" @click="calculateRedBookPrice">计算红本价格</el-button>
<el-button type="text" >计算数据</el-button> <el-button type="text" >计算数据</el-button>
</div> </div>
<!-- 物料表格控件 -->
<div class="table-box">
<el-table
:data="materialData"
border
:cell-style="cellStyle"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center' }">
<el-table-column
fixed
label="编号"
type="index"
width="50">
</el-table-column>
<el-table-column
width="180"
prop="prodCategory"
label="产品大类">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="180"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="180"
prop="voltLevel"
label="电压等级">
</el-table-column>
<el-table-column
width="180"
prop="measureUnit"
label="单位">
</el-table-column>
<el-table-column
width="180"
prop="matCostPrice"
label="材料成本价格(¥)">
<template slot-scope="scope">
{{ parseFloat(scope.row.matCostPrice).toFixed(2)}}
</template>
</el-table-column>
<el-table-column
width="180"
prop="redBookPrice"
label="红本价格(¥)">
<template slot-scope="scope">
{{ parseFloat(scope.row.redBookPrice).toFixed(2)}}
</template>
</el-table-column>
<el-table-column
width="180"
prop="redBookCost"
label="红本成本(¥)">
<template slot-scope="scope">
{{ parseFloat(scope.row.redBookCost).toFixed(2)}}
</template>
</el-table-column>
<el-table-column
width="180"
prop="rbFacPrice"
label="红本厂价(¥)">
<template slot-scope="scope">
{{ parseFloat(scope.row.rbFacPrice).toFixed(2)}}
</template>
</el-table-column>
<el-table-column
width="180"
prop="number"
label="数量">
<template v-slot="scope">
<el-input v-model="scope.row.number">
</el-input>
</template>
</el-table-column>
<el-table-column
width="180"
prop="varRatio"
label="差异比率">
<!-- 自定义表头 -->
<template slot="header" slot-scope="scope">
<div>
差异比率
<el-tooltip effect="dark" content="差异比率 = (红本厂价 - 材料成本价格) / 红本厂价">
<i class="el-icon-question"></i>
</el-tooltip>
</div>
</template>
<!-- 列内容 -->
<template slot-scope="scope">
<!-- 这里是列的具体内容 -->
{{ scope.row.varRatio }}
</template>
</el-table-column>
<el-table-column
width="180"
prop="wdFSurcharge"
label="盘具运费">
<template slot-scope="scope">
{{ (parseFloat(scope.row.wdFSurcharge) * 100).toFixed(2) + '%' }}
</template>
</el-table-column>
<el-table-column
width="180"
prop="manuCost"
label="制造成本">
<template slot-scope="scope">
{{ (parseFloat(scope.row.manuCost) * 100).toFixed(2) + '%' }}
</template>
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="totalCost"
label="总成本(¥)">
</el-table-column>
<el-table-column
fixed="right"
width="120"
prop="totalFacPrice"
label="总厂价(¥)">
</el-table-column>
<el-table-column
fixed="right"
width="200"
prop="totalVariance"
label="(总厂价 - 总成本)/总厂价">
</el-table-column>
<el-table-column
fixed="right"
width="180"
label="操作">
<template slot-scope="scope">
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">删除</el-button>
<el-button @click="handleDeleteClick(scope.$index)" style="color: red;" type="text">查看详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div> </div>
<!------------------------ dialog控件 ------------------------------------>
<el-dialog class="materialDialogTable" :visible.sync="dialogMaterialVisible" width="1100px">
<div slot="title" style="margin: 0px">
<el-form>
<el-form-item >
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.precMaterialName" placeholder="开头物料名称精确查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueMaterialName" placeholder="物料名称模糊查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueModel" placeholder="规格模糊查询">
</el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item>
</el-form>
</div>
<div style="display: flex; flex-direction: row;">
<div style="width: 700px">
<el-table
:data="materialDialogData"
@selection-change="handleSelectionChange"
ref="materialDialogData"
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
:cell-style="{'text-align': 'center', 'padding': '5px 0px'}"
highlight-selection-row
:row-key="row => row.uid"
:reserve-selection="true"
border>
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="序号"
type="index"
width="55">
</el-table-column>
<el-table-column
width="120"
prop="prodCategory"
label="产品大类">
</el-table-column>
<el-table-column
width="120"
prop="model"
label="型号">
</el-table-column>
<el-table-column
width="125"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="120"
prop="voltLevel"
label="电压">
</el-table-column>
<el-table-column
width="102"
prop="measureUnit"
label="单位">
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="materialQueryParams.pageNum"
:limit.sync="materialQueryParams.pageSize"
@pagination="searchMaterial"
/>
</div>
<div style="flex-grow: 1; padding-left: 20px;">
<div
v-for="(selectedItem, index) in selectedMaterialItems"
:key="index"
class="selected-item"
>
{{ selectedItem.model }} , {{ selectedItem.specification }} , {{ selectedItem.voltLevel }}
<el-button @click="removeSelectedItem(selectedItem)" type="text" class="remove-btn">&#10006;</el-button>
</div>
</div>
</div>
<div style="text-align: center; padding-top: 20px">
<el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
<el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {queryMaterialListByParam, queryRedBookPriceByParam } from "@/api/quote/quote";
const commonRule = [ const commonRule = [
{ required: true, message: '不能为空值可填0', trigger: 'blur' }, { required: true, message: '不能为空值可填0', trigger: 'blur' },
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' } { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' }
@ -266,58 +526,31 @@ export default {
data() { data() {
return { return {
formLabelAlign: { formLabelAlign: {
officeExpense: 0.022, officeExpense: { value: 0.022, defaultValue: 0.022, fieldStatus: false },
travelExpense: 0.011, travelExpense: { value: 0.011, defaultValue: 0.011, fieldStatus: false },
salaryInsur: 0.394, salaryInsur: { value: 0.394, defaultValue: 0.394, fieldStatus: false },
otherMgmtExpense: 0.373, otherMgmtExpense: { value: 0.373, defaultValue: 0.373, fieldStatus: false },
carExpense: 0.010, carExpense: { value: 0.010, defaultValue: 0.010, fieldStatus: false },
mgmtBizEntFee:0.156, //- mgmtBizEntFee: { value: 0.156, defaultValue: 0.156, fieldStatus: false },
mgmtDeprecExpense: 0.016, //- mgmtDeprecExpense: { value: 0.016, defaultValue: 0.016, fieldStatus: false },
consultAuditFee: 0.026, // consultAuditFee: { value: 0.026, defaultValue: 0.026, fieldStatus: false },
tenderCost: 0.023, // tenderCost: { value: 0.023, defaultValue: 0.023, fieldStatus: false },
rentExpense: 0.052, // rentExpense: { value: 0.052, defaultValue: 0.052, fieldStatus: false },
salary: 0.239, // salary: { value: 0.239, defaultValue: 0.239, fieldStatus: false },
inspectFee: 0.016, // inspectFee: { value: 0.016, defaultValue: 0.016, fieldStatus: false },
transTravelExpense: 0.020, // transTravelExpense: { value: 0.020, defaultValue: 0.020, fieldStatus: false },
otherSalesExpense: 0.073, // otherSalesExpense: { value: 0.073, defaultValue: 0.073, fieldStatus: false },
biddingCost: 0.134, // biddingCost: { value: 0.134, defaultValue: 0.134, fieldStatus: false },
bizFee: 1.183, //- bizFee: { value: 1.183, defaultValue: 1.183, fieldStatus: false },
salesBizEntFee: 0.098, //- salesBizEntFee: { value: 0.098, defaultValue: 0.098, fieldStatus: false },
transpHandlingFee: 0.621, // transpHandlingFee: { value: 0.621, defaultValue: 0.621, fieldStatus: false },
manufDeprecExpense: 0.217, //- manufDeprecExpense: { value: 0.217, defaultValue: 0.217, fieldStatus: false },
interestExpense: 0.436, // interestExpense: { value: 0.436, defaultValue: 0.436, fieldStatus: false },
handlingFee: 0.108, // handlingFee: { value: 0.108, defaultValue: 0.108, fieldStatus: false },
discInterest: 0.363, // discInterest: { value: 0.363, defaultValue: 0.363, fieldStatus: false },
otherFinExpenses: 0.197, //- otherFinExpenses: { value: 0.197, defaultValue: 0.197, fieldStatus: false },
invOpCost: 0.031, // invOpCost: { value: 0.031, defaultValue: 0.031, fieldStatus: false },
tax: 1.5, // tax: { value: 1.5, defaultValue: 1.5, fieldStatus: false }, //
},
formLabelAlignDefault: {
officeExpense: 0.022,
travelExpense: 0.011,
salaryInsur: 0.394,
otherMgmtExpense: 0.373,
carExpense: 0.010,
mgmtBizEntFee:0.156, //-
mgmtDeprecExpense: 0.016, //-
consultAuditFee: 0.026, //
tenderCost: 0.023, //
rentExpense: 0.052, //
salary: 0.239, //
inspectFee: 0.016, //
transTravelExpense: 0.020, //
otherSalesExpense: 0.073, //
biddingCost: 0.134, //
bizFee: 1.183, //-
salesBizEntFee: 0.098, //-
transpHandlingFee: 0.621, //
manufDeprecExpense: 0.217, //-
interestExpense: 0.436, //
handlingFee: 0.108, //
discInterest: 0.363, //
otherFinExpenses: 0.197, //-
invOpCost: 0.031, //
tax: 1.5, //
}, },
totalForm: { totalForm: {
totalFinExpenses: 0, totalFinExpenses: 0,
@ -326,33 +559,50 @@ export default {
totalDifferenceValue: 0 totalDifferenceValue: 0
}, },
formRules: { formRules: {
officeExpense: commonRule, 'officeExpense.value': commonRule,
travelExpense: commonRule, 'travelExpense.value': commonRule,
salaryInsur: commonRule, 'salaryInsur.value': commonRule,
otherMgmtExpense: commonRule, 'otherMgmtExpense.value': commonRule,
carExpense: commonRule, 'carExpense.value': commonRule,
mgmtBizEntFee: commonRule, 'mgmtBizEntFee.value': commonRule,
mgmtDeprecExpense: commonRule, 'mgmtDeprecExpense.value': commonRule,
tenderCost: commonRule, 'tenderCost.value': commonRule,
rentExpense: commonRule, 'rentExpense.value': commonRule,
salary: commonRule, 'salary.value': commonRule,
inspectFee: commonRule, 'inspectFee.value': commonRule,
transTravelExpense: commonRule, 'transTravelExpense.value': commonRule,
otherSalesExpense: commonRule, 'otherSalesExpense.value': commonRule,
biddingCost: commonRule, 'biddingCost.value': commonRule,
bizFee: commonRule, 'bizFee.value': commonRule,
consultAuditFee: commonRule, 'consultAuditFee.value': commonRule,
transpHandlingFee: commonRule, 'transpHandlingFee.value': commonRule,
manufDeprecExpense: commonRule, 'manufDeprecExpense.value': commonRule,
interestExpense: commonRule, 'interestExpense.value': commonRule,
handlingFee: commonRule, 'handlingFee.value': commonRule,
discInterest: commonRule, 'discInterest.value': commonRule,
otherFinExpenses: commonRule, 'otherFinExpenses.value': commonRule,
invOpCost: commonRule, 'invOpCost.value': commonRule,
tax: commonRule, 'tax.value': commonRule,
salesBizEntFee: commonRule 'salesBizEntFee.value': commonRule
// Add similar rules for other form fields // Add similar rules for other form fields
}, },
materialData: [
],
dialogMaterialVisible: false,
materialQueryParams: {
pageNum: 1,
pageSize: 10,
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
},
materialDialogData: [
],
selectedMaterialItems: [], //
savedSelectedMaterials: [], //
total: 0,
} }
}, },
computed: { computed: {
@ -369,15 +619,106 @@ export default {
async init () { async init () {
}, },
/**--------------表单验证函数------------**/ /**--------------输入值改变则底色发生变化------------**/
validatePercentage(rule, value, callback) { validateAndSetDefault(formLabelAlign, field) {
const numValue = parseFloat(value); if (formLabelAlign[field].value !== formLabelAlign[field].defaultValue) {
if (isNaN(numValue) || numValue < 0 || numValue > 100) { this.$set(formLabelAlign, field, {
callback(new Error('Please enter a number between 0 and 100')); ...formLabelAlign[field],
} else { fieldStatus: true
callback(); });
} }
}, },
/**-----------恢复默认------------**/
restoreDefaults() {
for (const key in this.formLabelAlign) {
if (this.formLabelAlign.hasOwnProperty(key)) {
// valuedefaultValue
this.$set(this.formLabelAlign, key, {
value: this.formLabelAlign[key].defaultValue,
defaultValue: this.formLabelAlign[key].defaultValue,
fieldStatus: false,
});
}
}
},
/**-------物料表格的cell样式----------**/
cellStyle({row, column, rowIndex, columnIndex}) {
if(columnIndex === 0) {
return 'color : black; text-align : center; background : #E0E0E0; padding: 0px';
} else if (columnIndex === 6 || columnIndex === 9) {
return 'text-align : center; background : #F5F5F5; padding: 0px';
} else {
return ' text-align : center; padding: 0px';
}
},
/**-------物料表格的删除操作----------**/
handleDeleteClick(index){
this.materialData.splice(index, 1)
},
/**--------添加物料打开物料dialog框---------**/
addMaterial(){
this.dialogMaterialVisible = true;
},
/**--------查询物料---------**/
searchMaterial() {
queryMaterialListByParam(this.materialQueryParams).then(response => {
this.materialDialogData = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleSelectionChange(selection) {
selection.forEach(item => {
//
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.uid === item.uid)) {
console.log(item)
this.selectedMaterialItems.push(item);
}
});
},
removeSelectedItem(selectedItem) {
//
const isSelected = this.$refs.materialDialogData.selection.includes(selectedItem);
//
const index = this.selectedMaterialItems.findIndex(item => item.uid === selectedItem.uid);
if (index !== -1) {
this.selectedMaterialItems.splice(index, 1);
}
// el-table
if (isSelected) {
this.$refs.materialDialogData.toggleRowSelection(selectedItem, false);
}
},
/**-------------dialog确认按钮将物料添加进表格-----------------**/
addMaterialToTable() {
//
this.materialData = this.materialData.concat(this.selectedMaterialItems);
console.log(this.materialData)
//
this.selectedMaterialItems = [];
this.$refs.materialDialogData.clearSelection();
this.dialogMaterialVisible = false;
},
closeMaterialDialog() {
this.dialogMaterialVisible = false;
},
/**----------------计算红本价格--------------------**/
calculateRedBookPrice() {
const param = this.materialData.map(item => ({
model: item.model,
specification: item.specification,
voltLevel: item.voltLevel
}));
queryRedBookPriceByParam(param).then(response => {
});
}
}, },
} }
</script> </script>
@ -419,4 +760,54 @@ export default {
backdrop-filter: blur(10px); /* 调整模糊度 */ backdrop-filter: blur(10px); /* 调整模糊度 */
-webkit-backdrop-filter: blur(10px); /* 兼容性处理适用于一些WebKit浏览器 */ -webkit-backdrop-filter: blur(10px); /* 兼容性处理适用于一些WebKit浏览器 */
} }
.changed-field {
background-color: #add8e6; /* 更改后的背景颜色 */
}
::v-deep .materialDialogTable .el-dialog__header {
padding-bottom: 0px;
}
::v-deep .materialDialogTable .el-dialog__body {
padding-top: 0px;
}
.selected-item {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
padding: 5px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
}
.remove-btn {
padding: 0px;
color: red;
}
.table-box {
width: 98%;
margin: auto;
}
::v-deep .el-input__inner {
height: 30px;
/*font-family: Roboto, serif;*/
font-size: 12px;
line-height: 14px;
}
::v-deep .el-input-group {
margin-top: 3px;
}
::v-deep .total-box input {
background: #f0f0f0 !important;
font-weight: bold !important;
color: black !important;
}
</style> </style>