This commit is contained in:
xd 2024-05-14 10:31:00 +08:00
parent 2a43b84a47
commit fde4edce8e
11 changed files with 339 additions and 42 deletions

View File

@ -255,6 +255,14 @@ public class RedBookController extends BaseController
if(CollectionUtils.isEmpty(resCache)){
resCache = redBookService.versionList();
redisCache.setCacheObject(getCacheKey("versionList"),resCache);
}else{
// 判断是否有最新调价
String maxUid = resCache.get(0).getValue();//获取缓存里最新调价版本
String rb_price_version = redBookService.rb_price_version();//获取电子红本最新的调价版本
if(!rb_price_version.equals(maxUid)){
resCache = redBookService.versionList();
redisCache.setCacheObject(getCacheKey("versionList"),resCache);
}
}
ajax.put("versionList", resCache);
return ajax;
@ -296,4 +304,23 @@ public class RedBookController extends BaseController
List<Customer> list = redBookService.listQuots(oaQuot);
return getDataTable(list);
}
/**
* 获取报价详细信息
*/
@GetMapping(value = "/{quotId}")
public AjaxResult getInfo(@PathVariable("quotId") String quotId)
{
return success(redBookService.selectQuotByQuotId(quotId));
}
/**
* 删除报价单
*/
@Log(title = "OA报价单删除", businessType = BusinessType.DELETE)
@DeleteMapping("/deleteQuots/{quotId}")
public AjaxResult remove(@PathVariable String quotId)
{
return toAjax(redBookService.deleteQuotsByQuotId(quotId));
}
}

View File

@ -13,6 +13,8 @@ public class OAQuot extends BaseEntity {
private String quotLxrdh;//联系人电话
private String totalPrice;//总金额
private String rbDateUid;//调价版本
private List<OAQuotProduct> selectedResultData;
public String getQuot_id() { return quot_id; }
@ -59,6 +61,10 @@ public class OAQuot extends BaseEntity {
public void setTotalPrice(String totalPrice) { this.totalPrice = totalPrice; }
public String getRbDateUid() { return rbDateUid; }
public void setRbDateUid(String rbDateUid) { this.rbDateUid = rbDateUid; }
public List<OAQuotProduct> getSelectedResultData() {
return selectedResultData;
}

View File

@ -9,6 +9,7 @@ public class OAQuotProduct {
private String spec;//规格
private String voltage;//电压
private String stu;//单位
private String price;//红本价
private BigDecimal setPrice;//单价
private BigDecimal count;//数量
private BigDecimal allPrice;//金额
@ -58,6 +59,10 @@ public class OAQuotProduct {
this.stu = stu;
}
public String getPrice() { return price; }
public void setPrice(String price) { this.price = price; }
public BigDecimal getSetPrice() { return setPrice; }
public void setSetPrice(BigDecimal setPrice) { this.setPrice = setPrice; }

View File

@ -108,4 +108,25 @@ public interface OARedBookMapper
* @return
*/
List<Customer> listQuots(OAQuot oaQuot);
/**
* 获取报价详细信息
* @param quotId
* @return
*/
OAQuot selectQuotByQuotId(String quotId);
/**
* 删除报价单
* @param quotId
* @return
*/
int deleteQuotsByQuotId(String quotId);
void deleteQuotProductsByCusId(String quotId);
/**
* 获取本地记录的调价版本
* @return
*/
String rb_price_version();
}

View File

@ -101,4 +101,24 @@ public interface IRedBookService
* @return
*/
List<Customer> listQuots(OAQuot oaQuot);
/**
* 获取报价详细信息
* @param quotId
* @return
*/
OAQuot selectQuotByQuotId(String quotId);
/**
* 删除报价单
* @param quotId
* @return
*/
int deleteQuotsByQuotId(String quotId);
/**
* 获取本地记录的调价版本
* @return
*/
String rb_price_version();
}

View File

@ -178,4 +178,34 @@ public class RedBookServiceImpl implements IRedBookService
public List<Customer> listQuots(OAQuot oaQuot) {
return oaRedBookMapper.listQuots(oaQuot);
}
/**
* 获取报价详细信息
* @param quotId
* @return
*/
@Override
public OAQuot selectQuotByQuotId(String quotId) {
return oaRedBookMapper.selectQuotByQuotId(quotId);
}
/**
* 删除报价单
* @param quotId
* @return
*/
@Override
public int deleteQuotsByQuotId(String quotId) {
oaRedBookMapper.deleteQuotProductsByCusId(quotId);
return oaRedBookMapper.deleteQuotsByQuotId(quotId);
}
/**
* 获取本地记录的调价版本
* @return
*/
@Override
public String rb_price_version() {
return oaRedBookMapper.rb_price_version();
}
}

View File

@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quotLxr != null and quotLxr != ''">quotLxr,</if>
<if test="quotLxrdh != null and quotLxrdh != ''">quotLxrdh,</if>
<if test="totalPrice != null and totalPrice != ''">totalPrice,</if>
<if test="rbDateUid != null and rbDateUid != ''">rbDateUid,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
</trim>
@ -101,15 +102,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quotLxr != null and quotLxr != ''">#{quotLxr},</if>
<if test="quotLxrdh != null and quotLxrdh != ''">#{quotLxrdh},</if>
<if test="totalPrice != null and totalPrice != ''">#{totalPrice},</if>
<if test="rbDateUid != null and rbDateUid != ''">#{rbDateUid},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
getdate()
</trim>
</insert>
<insert id="batchOAQuotProduct">
insert into OAQuotProduct(quot_product_id, name_0, name_1, spec, voltage,stu,setPrice,count,allPrice,per,per2,quot_id) values
insert into OAQuotProduct(quot_product_id, name_0, name_1, spec, voltage,stu,price,setPrice,count,allPrice,per,per2,quot_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.quot_product_id}, #{item.name_0}, #{item.name_1}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per2,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
( #{item.quot_product_id}, #{item.name_0}, #{item.name_1}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.price,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per2,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
</foreach>
</insert>
@ -146,9 +148,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from OAQuot a
<include refid="quotsJoins"/>
<where>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and datediff(d, a.create_time, #{params.beginTime}) <![CDATA[<=]]> 0
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and datediff(d, a.create_time, #{params.endTime}) <![CDATA[>=]]> 0
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
<resultMap type="OAQuot" id="QuotResult">
<result property="quot_id" column="quot_id" />
<result property="quotCode" column="quotCode" />
<result property="quotCustomer" column="quotCustomer" />
<result property="quotProject" column="quotProject" />
<result property="quotLxr" column="quotLxr" />
<result property="quotLxrdh" column="quotLxrdh" />
<result property="totalPrice" column="totalPrice" />
<result property="rbDateUid" column="rbDateUid" />
</resultMap>
<resultMap id="QuotQuotMaterialResult" type="OAQuot" extends="QuotResult">
<collection property="selectedResultData" notNullColumn="quot_product_id" javaType="java.util.List" resultMap="QuotMaterialResult" />
</resultMap>
<resultMap type="OAQuotProduct" id="QuotMaterialResult">
<result property="quot_product_id" column="quot_product_id" />
<result property="name_0" column="name_0" />
<result property="name_1" column="name_1" />
<result property="spec" column="spec" />
<result property="voltage" column="voltage" />
<result property="stu" column="stu" />
<result property="per" column="per" />
<result property="per2" column="per2" />
<result property="price" column="price" />
<result property="setPrice" column="setPrice" />
<result property="count" column="count" />
<result property="allPrice" column="allPrice" />
</resultMap>
<select id="selectQuotByQuotId" parameterType="String" resultMap="QuotQuotMaterialResult">
select a.quot_id, a.quotCode, a.quotCustomer, a.quotProject, a.quotLxr,
a.quotLxrdh, a.totalPrice,a.rbDateUid,
b.quot_product_id, b.name_0, b.name_1,
b.spec, b.voltage, b.stu,
b.per,b.per2,b.price,b.setPrice,b.count,b.allPrice,b.quot_id
from OAQuot a
left join OAQuotProduct b on b.quot_id = a.quot_id
where a.quot_id = #{quotId}
</select>
<delete id="deleteQuotsByQuotId" parameterType="java.lang.String">
delete from OAQuot where quot_id = #{quotId}
</delete>
<delete id="deleteQuotProductsByCusId" parameterType="java.lang.String">
delete from OAQuotProduct where quot_id = #{quotId}
</delete>
<select id="rb_price_version" resultType="String">
select top 1 muid from
(
select max(uid_0) muid,date_0 from rb_productVersion
where sta_0=1 or sta_0=0 group by date_0
)a order by date_0 desc
</select>
</mapper>

View File

@ -146,7 +146,20 @@ export function listQuots(query) {
params: query
})
}
// 查询报价单详细
export function getQuotDetail(quotId) {
return request({
url: '/redBook/redBook/' + quotId,
method: 'get'
})
}
// 删除报价单
export function deleteQuots(quotId) {
return request({
url: '/redBook/redBook/deleteQuots/' + quotId,
method: 'delete'
})
}

View File

@ -12,7 +12,7 @@ module.exports = {
/**
* 是否显示顶部导航
*/
topNav: false,
topNav: true,
/**
* 是否显示 tagsView

View File

@ -8,11 +8,11 @@
<el-button style="float: right;" size="mini" type="primary" icon="el-icon-search" @click="handleSearchClick">搜索</el-button>
</el-col>
<el-col :span="14">
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick">生成报价单</el-button>
<el-button style="float: right;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick">保存</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0">生成报价单</el-button>
<el-button style="float: right;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
</el-col>
</el-row>
<el-row :gutter="5"class="mt5">
<el-row :gutter="5" class="mt5">
<el-col :span="10">
<el-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
<el-form-item label="目录:">
@ -65,7 +65,7 @@
:limit.sync="searchResultPageSize"
@size-change="handleSearchResultSizeChange"
@current-change="handleSearchResultCurrentChange"
:layout="'total, sizes, prev, pager, next'"
:layout="'total, prev, pager, next'"
/>
</el-card>
</el-col>
@ -100,18 +100,17 @@
<el-form-item label="总金额" prop="totalPrice" v-if="false">
<el-input v-model="form.totalPrice"/>
</el-form-item>
<el-form-item label="批量调折扣率" label-width="100px">
<el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDate" style="width: 50%;float: right" >
<el-form-item label="设置折扣率" label-width="100px">
<el-input style="width:65px" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:65px;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red;font-size: 15px">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDateUid" style="width: 235px;margin-left: 20px" :disabled="selectedResultData.length==0">
<el-option
v-for="item in versionList"
:key="item.value"
:label="item.label"
:value="item.value"
@click.native="selectRbDate(item.value)"
/>
@click.native="selectRbDate(item.value)"/>
</el-select>
</el-form-item>
</el-col>
@ -128,8 +127,8 @@
<el-table-column fixed="left" label="产品型号" align="center" prop="name_0" width="180" />
<el-table-column label="型号" align="center" prop="name_1" width="180" v-if="false"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="80"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="电压" align="center" prop="voltage" width="100"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="120"/>
<el-table-column label="单位" align="center" prop="stu" width="50"/>
<el-table-column label="一次折扣" align="center" prop="per" width="80">
<template slot-scope="scope">
@ -141,13 +140,13 @@
<el-input v-model="scope.row.per2" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="setPrice" width="80"/>
<el-table-column label="数量调整" align="center" prop="count" width="80">
<el-table-column label="单价" align="center" prop="setPrice" width="120"/>
<el-table-column label="数量调整" align="center" prop="count" width="100">
<template slot-scope="scope">
<el-input v-model="scope.row.count" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="allPrice" width="80"/>
<el-table-column label="总价" align="center" prop="allPrice" width="120"/>
</el-table>
<!--<pagination
v-show="selectedResultTotal>0"
@ -263,8 +262,8 @@
//
form: {totalPrice: ''},
//
versionList: [], //
//
versionList: [], //
}
},
created() {
@ -497,10 +496,10 @@
const voltage = row.voltage;
const price = row.price;
const stu = row.stu;
const per = '0.8';
const per2 = '';
const per = this.perc;
const per2 = this.perc2;
const count = '1';
const setPrice = toDecimal(price * per);
const setPrice = toDecimal(price * (per?per:1) * (per2?per2:1));
const allPrice = toDecimal(count * setPrice);
const rowDate = {
@ -635,11 +634,6 @@
},
//
handleMadeQuotClick() {
if(this.selectedResultData.length==0){
this.$modal.msgWarning("未选择报价产品信息");
return;
}
this.form.selectedResultData = this.selectedResultData;
madeQuot(this.form).then(response => {
this.$modal.msgSuccess("生成报价单成功");
@ -668,16 +662,11 @@
getVersionList(){
versionList(this.queryParams).then(response => {
this.versionList = response.versionList;
this.form.rbDate = this.versionList[0].value
this.form.rbDateUid = this.versionList[0].value
});
},
//
selectRbDate(uid){
if(this.selectedResultData.length==0){
this.$modal.msgWarning("未选择报价产品信息");
return;
}
this.selectedResultData.forEach((row, index) => {
this.$set(this.selectedResultData, index, {
...row,

View File

@ -20,9 +20,18 @@
</el-form>
<el-table width="100%" v-loading="loading" :data="quotsList" :row-class-name="rowQuotsIndex">
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column fixed="left" label="序号" align="center" prop="index" width="50"/>
<el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" @click="handleDeleteClick(scope.row)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="quot_id" align="center" prop="quot_id" v-if="false"/>
<el-table-column label="报价单号" width="260" align="center" prop="quotCode" />
<el-table-column label="报价单号" width="260" align="center" prop="quotCode">
<template slot-scope="scope">
<el-link :underline="false" type="primary" @click="handleDetail(scope.row)">{{scope.row.quotCode}}</el-link>
</template>
</el-table-column>
<el-table-column label="报价客户" width="200" align="center" prop="quotCustomer" />
<el-table-column label="报价项目" width="200" align="center" prop="quotProject" />
<el-table-column label="联系人"align="center" prop="quotLxr" />
@ -30,6 +39,68 @@
<el-table-column label="创建日期" width="200" align="center" prop="createTime" />
</el-table>
<!-- 报价详情对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1050px" append-to-body>
<el-form ref="form" :model="form" label-width="100px">
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="询价单位" prop="quotCustomer">
<el-input v-model="form.quotCustomer" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" prop="quotProject">
<el-input v-model="form.quotProject" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="联系人" prop="quotLxr">
<el-input v-model="form.quotLxr" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="quotLxrdh">
<el-input v-model="form.quotLxrdh" :disabled="true"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item>
总价:<span style="color:red;font-size: 20px">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDateUid" style="width: 60%;float: right" :disabled="true">
<el-option
v-for="item in versionList"
:key="item.value"
:label="item.label"
:value="item.value"
@click.native="selectRbDate(item.value)"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-table width="100%;" :row-class-name="selectedResultIndex" :data="selectedResultData" height="400px">
<el-table-column fixed="left" label="" align="center" prop="index" width="50"/>
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column fixed="left" label="产品型号" align="center" prop="name_0" width="180" />
<el-table-column label="型号" align="center" prop="name_1" v-if="false"/>
<el-table-column label="规格" align="center" prop="spec" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage"/>
<el-table-column label="红本价(元)" align="center" prop="price"/>
<el-table-column label="单位" align="center" prop="stu"/>
<el-table-column label="一次折扣" align="center" prop="per"/>
<el-table-column label="二次折扣" align="center" prop="per2"/>
<el-table-column label="单价" align="center" prop="setPrice"/>
<el-table-column label="数量调整" align="center" prop="count"/>
<el-table-column label="总价" align="center" prop="allPrice"/>
</el-table>
</el-form>
</el-dialog>
<pagination
v-show="total>0"
:total="total"
@ -41,7 +112,7 @@
</template>
<script>
import { listQuots } from "@/api/redBook/redBook";
import { versionList,listQuots,getQuotDetail,deleteQuots } from "@/api/redBook/redBook";
export default {
name: "quots",
@ -55,27 +126,46 @@
total: 0,
//
quotsList: [],
//
dateRange: [],
//
versionList: [], //
//
queryParams: {
pageNum: 1,
pageSize: 10
},
//
form: {},
//
title: "",
//
open: false,
//
selectedResultData: []
}
},
created() {
this.getList();
this.getVersionList();
},
methods: {
/** 查询报价单列表 */
getList() {
this.loading = true;
listQuots(this.queryParams).then(response => {
listQuots(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.quotsList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
getVersionList(){
versionList(this.queryParams).then(response => {
this.versionList = response.versionList;
});
},
rowQuotsIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
@ -90,7 +180,38 @@
this.resetForm("queryForm");
this.handleQuery();
},
}
/** 查看详情按钮操作 */
handleDetail(row) {
const quotId = row.quot_id;
getQuotDetail(quotId).then(response => {
this.form = response.data;
this.selectedResultData = response.data.selectedResultData;
this.open = true;
this.title = "报价单信息";
})
},
/** 数据序号 */
selectedResultIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 删除报价单 */
handleDeleteClick(row) {
const quotId = row.quot_id;
deleteQuots(quotId).then(response => {
this.$message.success("删除成功");
this.getList();
})
},
},
computed: {
//
sumSelectedResultData() {
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
return allPrice.toFixed(2);
},
},
}
</script>