This commit is contained in:
xd 2024-05-10 15:13:35 +08:00
parent bc43f03800
commit dbac2c0cf7
7 changed files with 358 additions and 111 deletions

View File

@ -3,11 +3,13 @@ package com.ruoyi.web.controller.redBook;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -154,5 +156,23 @@ public class RedBookController extends BaseController
List<Product> list = redBookService.searchData(product);
return list;
}
/**
* 点击查询按钮查询数据
* @param product
* @return
*/
@GetMapping("/handleSearchData")
public List<Product> handleSearchData(Product product)
{
List<Product> list = new ArrayList<>();
String name_0 = product.getName_0();//型号
String model = product.getModel();//规格
if(!StringUtils.isEmpty(name_0) || !StringUtils.isEmpty(model) ){
if(!StringUtils.isEmpty(name_0)){
name_0 = name_0.toUpperCase();
}
list = redBookService.handleSearchData(name_0,model);
}
return list;
}
}

View File

@ -4,6 +4,7 @@ import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.CMaterialCost;
import com.ruoyi.material.domain.temp;
import com.ruoyi.redBook.domain.Product;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -63,4 +64,12 @@ public interface OARedBookMapper
* @return
*/
List<Product> searchData(Product product);
/**
* 点击查询按钮查询数据
* @param name_0
* @param model
* @return
*/
List<Product> handleSearchData(@Param("name_0")String name_0,@Param("model")String model);
}

View File

@ -60,4 +60,12 @@ public interface IRedBookService
* @return
*/
List<Product> searchData(Product product);
/**
* 点击查询按钮查询数据
* @param name_0
* @param model
* @return
*/
List<Product> handleSearchData(String name_0,String model);
}

View File

@ -89,4 +89,15 @@ public class RedBookServiceImpl implements IRedBookService
public List<Product> searchData(Product product) {
return oaRedBookMapper.searchData(product);
}
/**
* 点击查询按钮查询数据
* @param name_0
* @param model
* @return
*/
@Override
public List<Product> handleSearchData(String name_0,String model) {
return oaRedBookMapper.handleSearchData(name_0,model);
}
}

View File

@ -65,4 +65,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and A.截面 = #{section} and A.型号 = #{name_0} order by A.order_0
</select>
<select id="handleSearchData" resultType="Product" parameterType="String">
select A.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,A.型号 model,isnull(A.规格,'') spec ,
convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate
from [rb_product_price] A
left join rb_productVersion B on A.version_uid_0=B.uid_0
where B.sta_0=1
<if test="name_0 != null and name_0 != ''">
and A.型号 like '%${name_0}%'
</if>
<if test="model != null and model != ''">
and A.规格 = #{model}
</if>
</select>
</mapper>

View File

@ -91,5 +91,14 @@ export function searchData(query) {
params: query
})
}
//点击查询按钮查询数据
export function handleSearchData(query) {
return request({
url: '/redBook/redBook/handleSearchData',
method: 'get',
params: query
})
}

View File

@ -1,35 +1,56 @@
<template>
<div class="app-container">
<el-form label-width="100px">
<el-row style="letter-spacing: 3px;" :gutter="5">
<el-col :span="12">
<el-form label-width="100px" :model="form">
<el-row :gutter="5">
<el-col :span="10">
<el-input style="width:30%" size="mini" v-model="queryParams.name_0" placeholder="型号 模糊查询"></el-input>
<el-input style="width:30%;margin-left: 5px;" size="mini" v-model="queryParams.model" placeholder="规格 模糊查询"></el-input>
<el-button style="float: right;" size="mini" type="primary" icon="el-icon-search" @click="handleSearchClick">搜索</el-button>
</el-col>
<el-col :span="14"></el-col>
</el-row>
<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="目录:">
<el-button class="block" size="mini" :type="selectedModelTag==item.name_0?'warning':'primary'" plain @click="selModelTag(item)" v-for="(item, index) in modelList" :key="index">{{item.name_0}}</el-button>
<el-link :underline="false" class="block" :type="selectedModelTag==item.name_0?'warning':'primary'" @click="selModelTag(item)" v-for="(item, index) in modelList" :key="index">{{item.name_0}}</el-link>
</el-form-item>
<el-form-item label="备注:" v-if="showRemarkList">
<div class="text-content">
<div v-if="expandedIndex === id">
<el-button type="text" style="float: right" @click="toggleText(-1)">收起</el-button>
<div v-for="(item, index) in remarkList" :key="index" style="line-height: 25px">
{{index+1}}{{item.remark_0}}
</div>
</div>
<div v-else>
<el-button type="text" style="float: right" @click="toggleText(id)">更多</el-button>
<div class="text-preview">
<div v-for="(item, index) in remarkList" :key="index" style="line-height: 25px">
{{index+1}}{{item.remark_0}}
</div>
</div>
</div>
</div>
</el-form-item>
<el-form-item label="型号:" v-if="showXinghList">
<el-button class="block" size="mini" :type="selectedXinghTag==item.name_0?'warning':'primary'" plain @click="selXinghTag(item)" v-for="(item, index) in xinghList" :key="index">{{item.name_0}}</el-button>
<el-link :underline="false" class="block" :type="selectedXinghTag==item.name_0?'warning':'primary'" plain @click="selXinghTag(item)" v-for="(item, index) in xinghList" :key="index">{{item.name_0}}</el-link>
</el-form-item>
<el-form-item label="子类:" v-if="showZlList">
<el-button class="block" size="mini" :type="selectedZlTag==item.name_0?'warning':'primary'" plain @click="selZlTag(item)" v-for="(item, index) in zlList" :key="index">{{item.name_0}}</el-button>
<el-link :underline="false" class="block" size="mini" :type="selectedZlTag==item.name_0?'warning':'primary'" plain @click="selZlTag(item)" v-for="(item, index) in zlList" :key="index">{{item.name_0}}</el-link>
</el-form-item>
<el-form-item label="衍生型号:" v-if="showYsxhList">
<el-button class="block" size="mini" :type="selectedYsxhTag==item.name_0?'warning':'primary'" plain @click="selYsxhTag(item)" v-for="(item, index) in ysxhList" :key="index">{{item.name_0}}</el-button>
<el-link :underline="false" class="block" :type="selectedYsxhTag==item.name_0?'warning':'primary'" plain @click="selYsxhTag(item)" v-for="(item, index) in ysxhList" :key="index">{{item.name_0}}</el-link>
</el-form-item>
<el-form-item label="截面:" v-if="showJmList">
<el-button class="block" size="mini" :type="selectedJmTag==item.section?'warning':'primary'" plain @click="selJmTag(item)" v-for="(item, index) in jmList" :key="index">{{item.section}}</el-button>
<el-link :underline="false"class="block" :type="selectedJmTag==item.section?'warning':'primary'" plain @click="selJmTag(item)" v-for="(item, index) in jmList" :key="index">{{item.section}}</el-link>
</el-form-item>
<el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick">
<el-table-column label="uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column label="型号" align="center" prop="name_0" width="280"/>
<el-table-column label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="电压" align="center" prop="voltage" width="120"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="120"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="单位" align="center" prop="stu"/>
</el-table>
<pagination
@ -42,41 +63,74 @@
/>
</el-card>
</el-col>
<el-col :span="12">
<el-col :span="14" rowspan="2">
<el-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="询价单位" prop="cusCode">
<el-input v-model="form.quotCustomer" placeholder="请输入询价单位" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="项目名称" prop="cusSapCode">
<el-input v-model="form.quotProject" placeholder="请输入项目名称"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="业务联系人" prop="cusCode">
<el-input v-model="form.quotLxr" placeholder="请输入业务联系人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联 系 电 话" prop="cusSapCode">
<el-input v-model="form.quotLxrdh" placeholder="请输入联系电话"/>
</el-form-item>
</el-col>
</el-row>
<span>批量调折扣率:
<el-input-number v-model="perc" size="small" controls-position="right" :min="0" :max="6" :step="0.5"></el-input-number>%
<el-input-number v-model="perc2" size="small" controls-position="right" :min="0" :max="6" :step="0.5"></el-input-number>%
<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>
<el-table width="100%;" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
<el-table width="100%;" :style="{'margin-top':'5px','height': tableHeight}" ref="selectedResultTable" :data="selectedResultPagedData">
<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.$index)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="电压" align="center" prop="voltage" width="120"/>
<el-table-column label="型号" align="center" prop="name_0"/>
<el-table-column label="电压" align="center" prop="voltage" width="100"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="单位" align="center" prop="stu" width="80"/>
<el-table-column label="一次折扣" align="center" prop="percent" width="100">
<el-table-column label="单位" align="center" prop="stu" width="60"/>
<el-table-column label="一次折扣" align="center" prop="percent" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.percent"/>
<el-input v-model="scope.row.percent" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="二次折扣" align="center" prop="percent2" width="100">
<el-table-column label="二次折扣" align="center" prop="percent2" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.percent2"/>
<el-input v-model="scope.row.percent2" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="setPrice" width="100"/>
<el-table-column label="数量调整" align="center" prop="count" width="100">
<el-table-column label="单价" align="center" prop="setPrice" width="80"/>
<el-table-column label="数量调整" align="center" prop="count" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.count"/>
<el-input v-model="scope.row.count" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="allPrice" width="100"/>
<el-table-column label="总价" align="center" prop="allPrice" width="80"/>
</el-table>
<pagination
v-show="selectedResultTotal>0"
:total="selectedResultTotal"
:page.sync="selectedResultCurrentPage"
:page-sizes="[5,10,15,20]"
:limit.sync="selectedResultPageSize"
@size-change="handleSelectedResultSizeChange"
@current-change="handleSelectedResultCurrentChange"
/>
</el-card>
</el-col>
</el-row>
@ -84,18 +138,30 @@
</div>
</template>
<style>
/* 设置间距 */
.block {
margin: 5px;
margin-left: 20px;
display: inline-block;
}
/* 设置行距 */
.el-form-item--medium .el-form-item__content {
line-height: 25px;
}
/*卡片内容滚动条设置*/
.scrollable::-webkit-scrollbar {
display: none; /* 对于Webkit浏览器 */
}
/*备注内容设置*/
.text-content .text-preview {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* 控制显示的行数 */
}
</style>
<script>
import {toDecimal, productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData} from "@/api/redBook/redBook";
import {toDecimal, productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData} from "@/api/redBook/redBook";
export default {
name: "productSelect",
@ -103,6 +169,16 @@
return {
//
scrollableHeight:null,
//
tableHeight:null,
//
expandedIndex: -1, // -1
id: 1,
//
queryParams: {},
//tag
selectedModelTag:"",
selectedModelUid:"",
@ -145,12 +221,19 @@
searchResultPageSize: 10,
searchResultData: [],
/**==============已选择结果========================= */
//
selectedResultTotal: 0,
selectedResultCurrentPage: 1,
selectedResultPageSize: 5,
selectedResultData: [],
//
perc: 0,
perc2: 0
perc: 0.8,
perc2: '',
//
form: {}
}
},
created() {
@ -158,11 +241,22 @@
},
mounted(){
/*设置内容高度*/
this.scrollableHeight = (window.innerHeight - 130) + 'px';
this.scrollableHeight = (window.innerHeight - 160) + 'px';
/*设置已选择结果表格高度*/
this.tableHeight = (window.innerHeight - 400) + 'px';
},
methods: {
// // ||
toggleText(id) {
if (this.expandedIndex === id) {
this.expandedIndex = -1;
} else {
this.expandedIndex = id;
}
},
//
selModelTag(item){
selModelTag(item) {
this.showRemarkList = false,
this.remarkList = [],
@ -194,30 +288,30 @@
this.productXinghList(item.uid_0)
},
//
productList(){
productList() {
productList().then(response => {
console.log(response)
this.modelList = response;
});
},
//
productRemarkList(sid){
this.params = {uid_0:sid}
productRemarkList(sid) {
this.params = {uid_0: sid}
productRemarkList(this.params).then(response => {
this.remarkList = response;
this.showRemarkList = this.remarkList.length>0?true:false
this.showRemarkList = this.remarkList.length > 0 ? true : false
});
},
//
productXinghList(sid){
this.params = {uid_0:sid}
productXinghList(sid) {
this.params = {uid_0: sid}
productXinghList(this.params).then(response => {
this.xinghList = response;
this.showXinghList = this.xinghList.length>0?true:false
this.showXinghList = this.xinghList.length > 0 ? true : false
});
},
//
selXinghTag(item){
selXinghTag(item) {
this.selectedZlTag = '';
this.showZlList = false,
this.ZlList = [],
@ -240,49 +334,49 @@
this.judgeparent(item)
},
//
judgeparent(item){
this.params = {uid_0:item.uid_0}
judgeparent(item) {
this.params = {uid_0: item.uid_0}
judgeparent(this.params).then(response => {
if(response){//
if (response) {//
this.productZlList(item.uid_0)
}else{//
this.productYsxhListCheck(item.uid_0,item.name_0)
} else {//
this.productYsxhListCheck(item.uid_0, item.name_0)
}
});
},
//
productZlList(sid){
this.params = {uid_0:sid}
productZlList(sid) {
this.params = {uid_0: sid}
productZlList(this.params).then(response => {
this.zlList = response;
this.showZlList = this.zlList.length>0?true:false
this.showZlList = this.zlList.length > 0 ? true : false
});
},
//
productYsxhListCheck(sid,name){
this.params = {uid_0:sid}
productYsxhListCheck(sid, name) {
this.params = {uid_0: sid}
productYsxhListCheck(this.params).then(response => {
if(response){//
this.productYsxhList(sid,name)
}else{
if (response) {//
this.productYsxhList(sid, name)
} else {
this.selectedYsxhUid = sid;
this.selectedYsxhTag = name;
//
this.productJmListCheck(sid,name)
this.productJmListCheck(sid, name)
}
});
},
//
productYsxhList(sid,name){
this.params = {uid_0:sid,name_0:name}
productYsxhList(sid, name) {
this.params = {uid_0: sid, name_0: name}
productYsxhList(this.params).then(response => {
this.ysxhList = response;
this.showYsxhList = this.ysxhList.length>0?true:false
this.showYsxhList = this.ysxhList.length > 0 ? true : false
});
},
//
selZlTag(item){
selZlTag(item) {
this.selectedYsxhTag = '';
this.showYsxhList = false,
this.ysxhList = [],
@ -298,11 +392,11 @@
this.selectedZlTag = item.name_0;
console.log(this.selectedZlTag)
this.productYsxhListCheck(item.uid_0,item.name_0)
this.productYsxhListCheck(item.uid_0, item.name_0)
},
//
selYsxhTag(item){
selYsxhTag(item) {
this.selectedJmTag = '';
this.selectedYsxhUid = item.uid_0;
this.showJmList = false,
@ -314,15 +408,15 @@
this.selectedYsxhTag = item.name_0;
console.log(this.selectedYsxhTag)
this.productJmListCheck(item.uid_0,item.name_0)
this.productJmListCheck(item.uid_0, item.name_0)
},
//
productJmListCheck(sid,name){
this.params = {uid_0:sid}
productJmListCheck(sid, name) {
this.params = {uid_0: sid}
productJmListCheck(this.params).then(response => {
if(response){//
this.productJmList(sid,name)
}else{
if (response) {//
this.productJmList(sid, name)
} else {
//
console.log("结果表格输出")
//TODO
@ -330,15 +424,15 @@
});
},
//
productJmList(sid,name){
this.params = {uid_0:sid,name_0:name}
productJmList(sid, name) {
this.params = {uid_0: sid, name_0: name}
productJmList(this.params).then(response => {
this.jmList = response;
this.showJmList = this.jmList.length>0?true:false
this.showJmList = this.jmList.length > 0 ? true : false
});
},
//
selJmTag(item){
selJmTag(item) {
this.selectedJmTag = item.section;
console.log(this.selectedYsxhTag)
console.log(this.selectedYsxhUid)
@ -348,12 +442,12 @@
this.searchResultData = [],
this.searchResultLoading = true;
this.searchData(this.selectedYsxhUid,item.section)
this.searchData(this.selectedYsxhUid, item.section)
},
//
searchData(sid,section){
this.params = {uid_0:sid,section:section,name_0:this.selectedYsxhTag}
searchData(sid, section) {
this.params = {uid_0: sid, section: section, name_0: this.selectedYsxhTag}
searchData(this.params).then(response => {
console.log(response)
this.searchResultData = response;
@ -362,34 +456,109 @@
this.searchResultLoading = false;
});
},
//
handleRowDblclick(row, event, column){
//
handleRowDblclick(row, event, column) {
const name_0 = row.name_0;
const voltage = row.voltage;
const price = row.price;
const percent = '1';
const percent2 = '1';
const stu = row.stu;
const percent = '0.8';
const percent2 = '';
const count = '1';
row.percent = percent;
row.percent2 = percent2;
row.setPrice = price;
row.count = count;
const allPrice = toDecimal(count*price);
row.allPrice = allPrice;
this.selectedResultData.push(row)
const setPrice = toDecimal(price * percent);
const allPrice = toDecimal(count * setPrice);
const rowDate = {
name_0: name_0,
voltage: voltage,
price: price,
stu: stu,
percent: percent,
percent2: percent2,
setPrice: setPrice,
count: count,
allPrice: allPrice
}
this.selectedResultData.push(rowDate)
this.selectedResultTotal = this.selectedResultData.length;
const page = Math.ceil(this.selectedResultTotal / this.selectedResultPageSize);
this.handleSelectedResultCurrentChange(page)
},
//
handleDeleteClick(index){
//
handleDeleteClick(index) {
this.selectedResultData.splice(index, 1)
this.selectedResultTotal = this.selectedResultData.length;
},
/** 切换每页显示条数 */
/** 切换每页显示条数--查询结果 */
handleSearchResultSizeChange(val) {
this.bankCodePageSize = val;
this.bankCodeCurrentPage = 1;
this.searchResultPageSize = val;
this.searchResultCurrentPage = 1;
},
/** 页码选择 */
/** 页码选择--查询结果 */
handleSearchResultCurrentChange(val) {
this.bankCodeCurrentPage = val;
this.searchResultCurrentPage = val;
},
/** 切换每页显示条数--已选择结果 */
handleSelectedResultSizeChange(val) {
this.selectedResultPageSize = val;
this.selectedResultCurrentPage = 1;
},
/** 页码选择--已选择结果 */
handleSelectedResultCurrentChange(val) {
this.selectedResultCurrentPage = val;
},
//
handleSearchClick() {
if (this.queryParams.name_0 || this.queryParams.model) {
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
console.log(this.queryParams)
this.searchResultLoading = true;
handleSearchData(this.queryParams).then(response => {
console.log(response)
this.searchResultData = response;
this.searchResultTotal = this.searchResultData.length;
this.searchResultCurrentPage = 1;
this.searchResultLoading = false;
});
} else {
this.$message.warning("请输入查询条件!");
return;
}
},
//
changeData() {
//
this.selectedResultData.forEach((row, index) => {
//
this.$set(this.selectedResultData, index, {
...row,
percent: this.perc,
percent2: this.perc2,
setPrice: toDecimal(row.price * this.perc * (this.perc2?this.perc2:1)),
allPrice: toDecimal(row.count * row.price * this.perc * (this.perc2?this.perc2:1)),
});
})
},
//
changeRowData() {
//
this.selectedResultData.forEach((row, index) => {
//
this.$set(this.selectedResultData, index, {
...row,
setPrice: toDecimal(row.price * (row.percent?row.percent:1) * (row.percent2?row.percent2:1)),
allPrice: toDecimal(row.count * row.price * (row.percent?row.percent:1) * (row.percent2?row.percent2:1)),
});
})
},
},
updated(){
@ -405,6 +574,14 @@
const endIndex = startIndex + this.searchResultPageSize;
return this.searchResultData.slice(startIndex, endIndex);
},
//
selectedResultPagedData() {
console.log(this.selectedResultData)
const startIndex = (this.selectedResultCurrentPage - 1) * this.selectedResultPageSize;
const endIndex = startIndex + this.selectedResultPageSize;
return this.selectedResultData.slice(startIndex, endIndex);
},
},
}
</script>