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.annotation.DataSource;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.service.IRedBookService; import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -154,5 +156,23 @@ public class RedBookController extends BaseController
List<Product> list = redBookService.searchData(product); List<Product> list = redBookService.searchData(product);
return list; 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.CMaterialCost;
import com.ruoyi.material.domain.temp; import com.ruoyi.material.domain.temp;
import com.ruoyi.redBook.domain.Product; import com.ruoyi.redBook.domain.Product;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -63,4 +64,12 @@ public interface OARedBookMapper
* @return * @return
*/ */
List<Product> searchData(Product product); 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 * @return
*/ */
List<Product> searchData(Product product); 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) { public List<Product> searchData(Product product) {
return oaRedBookMapper.searchData(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 and A.截面 = #{section} and A.型号 = #{name_0} order by A.order_0
</select> </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> </mapper>

View File

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

View File

@ -1,35 +1,56 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form label-width="100px"> <el-form label-width="100px" :model="form">
<el-row style="letter-spacing: 3px;" :gutter="5"> <el-row :gutter="5">
<el-col :span="12"> <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-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
<el-form-item label="目录:"> <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>
<el-form-item label="备注:" v-if="showRemarkList"> <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"> <div v-for="(item, index) in remarkList" :key="index" style="line-height: 25px">
{{index+1}}{{item.remark_0}} {{index+1}}{{item.remark_0}}
</div> </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>
<el-form-item label="型号:" v-if="showXinghList"> <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>
<el-form-item label="子类:" v-if="showZlList"> <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>
<el-form-item label="衍生型号:" v-if="showYsxhList"> <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>
<el-form-item label="截面:" v-if="showJmList"> <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-form-item>
<el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick"> <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="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="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-column label="单位" align="center" prop="stu"/>
</el-table> </el-table>
<pagination <pagination
@ -42,41 +63,74 @@
/> />
</el-card> </el-card>
</el-col> </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-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>批量调折扣率: <span>批量调折扣率:
<el-input-number v-model="perc" 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-number v-model="perc2" size="small" controls-position="right" :min="0" :max="6" :step="0.5"></el-input-number>% <el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
</span> </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"> <el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" @click="handleDeleteClick(scope.$index)">删除</el-button> <el-button type="text" @click="handleDeleteClick(scope.$index)">删除</el-button>
</template> </template>
</el-table-column> </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"/>
<el-table-column label="型号" align="center" prop="name_0" width="180"/> <el-table-column label="电压" align="center" prop="voltage" width="100"/>
<el-table-column label="电压" align="center" prop="voltage" width="120"/>
<el-table-column label="红本价(元)" align="center" prop="price" 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="stu" width="60"/>
<el-table-column label="一次折扣" align="center" prop="percent" width="100"> <el-table-column label="一次折扣" align="center" prop="percent" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.percent"/> <el-input v-model="scope.row.percent" @blur="changeRowData"/>
</template> </template>
</el-table-column> </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"> <template slot-scope="scope">
<el-input v-model="scope.row.percent2"/> <el-input v-model="scope.row.percent2" @blur="changeRowData"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单价" align="center" prop="setPrice" width="100"/> <el-table-column label="单价" align="center" prop="setPrice" width="80"/>
<el-table-column label="数量调整" align="center" prop="count" width="100"> <el-table-column label="数量调整" align="center" prop="count" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.count"/> <el-input v-model="scope.row.count" @blur="changeRowData"/>
</template> </template>
</el-table-column> </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> </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-card>
</el-col> </el-col>
</el-row> </el-row>
@ -84,18 +138,30 @@
</div> </div>
</template> </template>
<style> <style>
/* 设置间距 */
.block { .block {
margin: 5px; margin-left: 20px;
display: inline-block; display: inline-block;
} }
/* 设置行距 */
.el-form-item--medium .el-form-item__content {
line-height: 25px;
}
/*卡片内容滚动条设置*/ /*卡片内容滚动条设置*/
.scrollable::-webkit-scrollbar { .scrollable::-webkit-scrollbar {
display: none; /* 对于Webkit浏览器 */ display: none; /* 对于Webkit浏览器 */
} }
/*备注内容设置*/
.text-content .text-preview {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/* 控制显示的行数 */
}
</style> </style>
<script> <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 { export default {
name: "productSelect", name: "productSelect",
@ -103,6 +169,16 @@
return { return {
// //
scrollableHeight:null, scrollableHeight:null,
//
tableHeight:null,
//
expandedIndex: -1, // -1
id: 1,
//
queryParams: {},
//tag //tag
selectedModelTag:"", selectedModelTag:"",
selectedModelUid:"", selectedModelUid:"",
@ -145,12 +221,19 @@
searchResultPageSize: 10, searchResultPageSize: 10,
searchResultData: [], searchResultData: [],
/**==============已选择结果========================= */
// //
selectedResultTotal: 0,
selectedResultCurrentPage: 1,
selectedResultPageSize: 5,
selectedResultData: [], selectedResultData: [],
// //
perc: 0, perc: 0.8,
perc2: 0 perc2: '',
//
form: {}
} }
}, },
created() { created() {
@ -158,9 +241,20 @@
}, },
mounted(){ mounted(){
/*设置内容高度*/ /*设置内容高度*/
this.scrollableHeight = (window.innerHeight - 130) + 'px'; this.scrollableHeight = (window.innerHeight - 160) + 'px';
/*设置已选择结果表格高度*/
this.tableHeight = (window.innerHeight - 400) + 'px';
}, },
methods: { methods: {
// // ||
toggleText(id) {
if (this.expandedIndex === id) {
this.expandedIndex = -1;
} else {
this.expandedIndex = id;
}
},
// //
selModelTag(item) { selModelTag(item) {
this.showRemarkList = false, this.showRemarkList = false,
@ -362,34 +456,109 @@
this.searchResultLoading = false; 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 price = row.price;
const percent = '1'; const stu = row.stu;
const percent2 = '1'; const percent = '0.8';
const percent2 = '';
const count = '1'; const count = '1';
row.percent = percent; const setPrice = toDecimal(price * percent);
row.percent2 = percent2; const allPrice = toDecimal(count * setPrice);
row.setPrice = price;
row.count = count; const rowDate = {
const allPrice = toDecimal(count*price); name_0: name_0,
row.allPrice = allPrice; voltage: voltage,
this.selectedResultData.push(row) 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.selectedResultData.splice(index, 1)
this.selectedResultTotal = this.selectedResultData.length;
}, },
/** 切换每页显示条数 */ /** 切换每页显示条数--查询结果 */
handleSearchResultSizeChange(val) { handleSearchResultSizeChange(val) {
this.bankCodePageSize = val; this.searchResultPageSize = val;
this.bankCodeCurrentPage = 1; this.searchResultCurrentPage = 1;
}, },
/** 页码选择 */ /** 页码选择--查询结果 */
handleSearchResultCurrentChange(val) { 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(){ updated(){
@ -405,6 +574,14 @@
const endIndex = startIndex + this.searchResultPageSize; const endIndex = startIndex + this.searchResultPageSize;
return this.searchResultData.slice(startIndex, endIndex); 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> </script>