This commit is contained in:
JIAL 2024-03-06 08:46:44 +08:00
parent 1144d37b31
commit 207197f91c
7 changed files with 691 additions and 161 deletions

View File

@ -0,0 +1,47 @@
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.quote.domain.MaterialDto;
import com.ruoyi.quote.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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);
}
}

View File

@ -0,0 +1,35 @@
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 String matCostPrice; //材料成本价格
private String redBookPrice; //红本价格
private String redBookCost; //红本成本
private String rbFacPrice; //红本厂价
private String manuCost; //制造成本
private String wdFSurcharge; //盘具点数
private Integer number = 1; //数量默认1
}

View File

@ -0,0 +1,49 @@
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
*/
@Mapper
public interface QuoteMapper {
@Select("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,\n" +
"b.price matCostPrice, d.factory_total_ratio/100 manuCost,d.factory_pj_ratio/100 wdFSurcharge,\n" +
"cc.红本价格 AS redBookPrice,cc.红本价格*0.8 rbFacPrice,dd.成本价格 AS redBookCost\n" +
"from c_material a \n" +
"left join \n" +
"(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\n" +
"left join c_yl_material b on a.cost_cl_id=b.material_no\n" +
"group by a.cost_material_id\n" +
")b on a.material_id=b.cost_material_id\n" +
"left join c_material_type_factory c on a.material_type_id = c.type_no\n" +
"left join c_factory d on d.factory_no = c.factory_id\n" +
"left join(select 型号,规格,电压等级,红本价格 from [REDBOOK].[RedBook].[dbo].rb_product_price \n" +
" where version_uid_0 = (select max(version_uid_0) from [REDBOOK].[RedBook].[dbo].rb_product_price a\n" +
" left join [REDBOOK].[RedBook].[dbo].rb_productVersion b on b.uid_0 = a.version_uid_0\n" +
" where b.tong_price_0 ='70') and 型号 like '$%{vagueMaterialName}%' \n" +
")as cc on cc.型号=a.material_xingh collate Chinese_PRC_CI_AS and cc.规格 = a.material_guig collate Chinese_PRC_CI_AS \n" +
"and cc.电压等级 = a.material_diany collate Chinese_PRC_CI_AS\n" +
"\n" +
"left join(select 型号,规格,电压等级,成本价格 from [REDBOOK].[RedBook].[dbo].rb_productbase_price \n" +
" where version_uid_0 = (select max(version_uid_0) from [REDBOOK].[RedBook].[dbo].rb_product_price a\n" +
" left join [REDBOOK].[RedBook].[dbo].rb_productVersion b on b.uid_0 = a.version_uid_0\n" +
" where b.tong_price_0 ='70') and 型号 like '$%{vagueMaterialName}%' \n" +
")as dd on dd.型号=a.material_xingh collate Chinese_PRC_CI_AS and dd.规格 = a.material_guig collate Chinese_PRC_CI_AS \n" +
" and dd.电压等级= a.material_diany collate Chinese_PRC_CI_AS\n" +
"where a.material_xingh like '${precMaterialName}%' AND a.material_xingh like '%${vagueMaterialName}%' AND a.material_guig like '%${vagueModel}%'"
)
List<MaterialDto> queryMaterialListByParam(@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,36 @@
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.queryMaterialListByParam(precMaterialName, vagueMaterialName, vagueModel);
}
}

View File

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

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,247 @@
</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" >计算数据</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 slot-scope="scope">
<el-input v-model="scope.row.number" @blur="validateNumber(scope.row)">
</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="queryParams.precMaterialName" placeholder="开头物料名称精确查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.vagueMaterialName" placeholder="物料名称模糊查询">
</el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.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: 688px">
<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="50">
</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="120"
prop="specification"
label="规格">
</el-table-column>
<el-table-column
width="120"
prop="voltLevel"
label="电压">
</el-table-column>
<el-table-column
width="100"
prop="measureUnit"
label="单位">
</el-table-column>
</el-table>
</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>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="searchMaterial"
/>
<div style="text-align: center; padding-top: 20px">
<el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" >确认</el-button>
<el-button type="warning" size="small" >取消</el-button>
</el-button-group>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {queryMaterialListByParam } 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 +524,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 +557,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,
queryParams: {
pageNum: 1,
pageSize: 10,
precMaterialName: '',
vagueMaterialName: '',
vagueModel: '',
},
materialDialogData: [
],
selectedMaterialItems: [], //
savedSelectedMaterials: [], //
total: 0,
} }
}, },
computed: { computed: {
@ -369,15 +617,94 @@ 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.queryParams).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)) {
this.selectedMaterialItems.push(item);
}
});
},
removeSelectedItem(selectedItem) {
//
const isSelected = this.$refs.materialTable.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.materialTable.toggleRowSelection(selectedItem, false);
}
},
addMaterialToTable() {
//
this.materialData = this.materialData.concat(this.selectedMaterialItems);
console.log(this.materialData)
//
this.selectedMaterialItems = [];
this.$refs.materialTable.clearSelection();
this.dialogMaterialVisible = false;
},
closeMaterialDialog() {
this.dialogMaterialVisible = false;
},
}, },
} }
</script> </script>
@ -419,4 +746,15 @@ 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: #ffe6e6; /* 更改后的背景颜色 */
}
.materialDialogTable .el-dialog__header{
padding: 20px 20px 0px !important;
}
.materialDialogTable .el-dialog__body{
padding: 0px 20px !important;
}
</style> </style>