Compare commits

...

4 Commits

Author SHA1 Message Date
xd dbac2c0cf7 '123' 2024-05-10 15:13:35 +08:00
xd bc43f03800 '123' 2024-05-09 17:28:24 +08:00
xd be70da84cb '123' 2024-05-09 17:22:20 +08:00
xd c923a46bca '12' 2024-05-09 17:17:03 +08:00
11 changed files with 1383 additions and 0 deletions

View File

@ -0,0 +1,178 @@
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;
/**
* 红本管理Controller
*
* @author ruoyi
* @date 2024-03-25
*/
@RestController
@RequestMapping("/redBook/redBook")
@DataSource(DataSourceType.OAREDBOOK)
public class RedBookController extends BaseController
{
@Autowired
private IRedBookService redBookService;
/**
* 获取目录
* @param product
* @return
*/
@GetMapping("/productList")
public List<Product> productList(Product product)
{
List<Product> list = redBookService.productModelList(product);
return list;
}
/**
* 获取备注信息
* @param product
* @return
*/
@GetMapping("/productRemarkList")
public List<Product> productRemarkList(Product product)
{
List<Product> list = redBookService.productRemarkList(product);
return list;
}
/**
* 获取型号
* @param product
* @return
*/
@GetMapping("/productXinghList")
public List<Product> productXinghList(Product product)
{
List<Product> list = redBookService.productModelList(product);
return list;
}
/**
* 判断是否为父节点如果有说明下面还有子类显示如果没有则直接显示衍生型号
* @param product
* @return
*/
@GetMapping("/judgeparent")
public Boolean judgeparent(Product product)
{
Boolean flag = false;
List<Product> list = redBookService.productModelList(product);
if(list!=null&&list.size()>0){
flag = true;
}
return flag;
}
/**
* 获取子类
* @param product
* @return
*/
@GetMapping("/productZlList")
public List<Product> productZlList(Product product)
{
List<Product> list = redBookService.productModelList(product);
return list;
}
/**
* 判断是否存在衍生型号
* @param product
* @return
*/
@GetMapping("/productYsxhListCheck")
public Boolean productYsxhListCheck(Product product)
{
Boolean flag = false;
List<Product> list = redBookService.productExtList(product);
if(list!=null&&list.size()>0){
flag = true;
}
return flag;
}
/**
* 获取衍生型号
* @param product
* @return
*/
@GetMapping("/productYsxhList")
public List<Product> productYsxhList(Product product)
{
List<Product> list = redBookService.productYsxhList(product);
return list;
}
/**
* 判断是否存在截面
* @param product
* @return
*/
@GetMapping("/productJmListCheck")
public Boolean productJmListCheck(Product product)
{
Boolean flag = false;
List<Product> list = redBookService.judgesection(product);
if(list!=null&&list.size()>0){
flag = true;
}
return flag;
}
/**
* 获取截面
* @param product
* @return
*/
@GetMapping("/productJmList")
public List<Product> productJmList(Product product)
{
List<Product> list = redBookService.productJmList(product);
return list;
}
/**
* 查询数据
* @param product
* @return
*/
@GetMapping("/searchData")
public List<Product> searchData(Product product)
{
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

@ -17,6 +17,14 @@ spring:
url: jdbc:sqlserver://172.19.6.3:1433;DatabaseName=RedBook
username: sa
password: Itcenter110-
# 红本数据库-OA单点登录数据源
oaredbook:
# 从数据源开关/默认关闭
enabled: true
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://192.168.9.90:1433;DatabaseName=RedBook
username: sa
password: Itcenter110-
# 江南全要素报价数据库数据源
quot:
# 从数据源开关/默认关闭

View File

@ -17,6 +17,11 @@ public enum DataSourceType
*/
REDBOOK,
/**
* 红本数据库-OA单点登录数据源
*/
OAREDBOOK,
/**
* 江南全要素报价数据库
*/

View File

@ -49,6 +49,15 @@ public class DruidConfig
return druidProperties.dataSource(dataSource);
}
@Bean
@ConfigurationProperties("spring.datasource.druid.oaredbook")
@ConditionalOnProperty(prefix = "spring.datasource.druid.oaredbook", name = "enabled", havingValue = "true")
public DataSource oaredbookDataSource(DruidProperties druidProperties)
{
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
return druidProperties.dataSource(dataSource);
}
@Bean
@ConfigurationProperties("spring.datasource.druid.quot")
@ConditionalOnProperty(prefix = "spring.datasource.druid.quot", name = "enabled", havingValue = "true")
@ -83,6 +92,7 @@ public class DruidConfig
Map<Object, Object> targetDataSources = new HashMap<>();
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
setDataSource(targetDataSources, DataSourceType.REDBOOK.name(), "redbookDataSource");
setDataSource(targetDataSources, DataSourceType.OAREDBOOK.name(), "oaredbookDataSource");
setDataSource(targetDataSources, DataSourceType.QUOT.name(), "quotDataSource");
setDataSource(targetDataSources, DataSourceType.JNERP.name(), "jnerpDataSource");
setDataSource(targetDataSources, DataSourceType.STORAGE.name(), "storageDataSource");

View File

@ -0,0 +1,157 @@
package com.ruoyi.redBook.domain;
public class Product {
private int uid_0;
private String name_0;
private String model;
private String spec;
private String section;
private String stu;
private float price;
private float newprice;
private float quantity;
private float amount;
private String voltage;
private String remark_0;
private String showname_0;
private String pricedate;
private float prime_0;
private float profitrate;
private String example_0;
public int getUid_0() {
return uid_0;
}
public void setUid_0(int uid_0) {
this.uid_0 = uid_0;
}
public String getName_0() {
return name_0;
}
public void setName_0(String name_0) {
this.name_0 = name_0;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getSection() {
return section;
}
public void setSection(String section) {
this.section = section;
}
public String getStu() {
return stu;
}
public void setStu(String stu) {
this.stu = stu;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public float getNewprice() {
return newprice;
}
public void setNewprice(float newprice) {
this.newprice = newprice;
}
public float getQuantity() {
return quantity;
}
public void setQuantity(float quantity) {
this.quantity = quantity;
}
public float getAmount() {
return amount;
}
public void setAmount(float amount) {
this.amount = amount;
}
public String getVoltage() {
return voltage;
}
public void setVoltage(String voltage) {
this.voltage = voltage;
}
public String getRemark_0() {
return remark_0;
}
public void setRemark_0(String remark_0) {
this.remark_0 = remark_0;
}
public String getShowname_0() {
return showname_0;
}
public void setShowname_0(String showname_0) {
this.showname_0 = showname_0;
}
public String getPricedate() {
return pricedate;
}
public void setPricedate(String pricedate) {
this.pricedate = pricedate;
}
public float getPrime_0() {
return prime_0;
}
public void setPrime_0(float prime_0) {
this.prime_0 = prime_0;
}
public float getProfitrate() {
return profitrate;
}
public void setProfitrate(float profitrate) {
this.profitrate = profitrate;
}
public String getExample_0() {
return example_0;
}
public void setExample_0(String example_0) {
this.example_0 = example_0;
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.redBook.mapper;
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;
/**
* 红本管理Mapper接口
*
* @author ruoyi
* @date 2024-02-28
*/
public interface OARedBookMapper
{
/**
* 获取目录
* @param product
* @return
*/
List<Product> productModelList(Product product);
/**
* 获取备注信息
* @param product
* @return
*/
List<Product> productRemarkList(Product product);
/**
* 判断是否存在衍生型号
* @param product
* @return
*/
List<Product> productExtList(Product product);
/**
* 获取衍生型号
* @param product
* @return
*/
List<Product> productYsxhList(Product product);
/**
* 判断是否存在截面
* @param product
* @return
*/
List<Product> judgesection(Product product);
/**
* 获取截面
* @param product
* @return
*/
List<Product> productJmList(Product product);
/**
* 查询数据
* @param product
* @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

@ -0,0 +1,71 @@
package com.ruoyi.redBook.service;
import com.ruoyi.redBook.domain.Product;
import java.util.List;
/**
* 红本管理Service接口
*
* @author ruoyi
* @date 2024-02-28
*/
public interface IRedBookService
{
/**
* 获取目录
* @param product
* @return
*/
List<Product> productModelList(Product product);
/**
* 获取备注信息
* @param product
* @return
*/
List<Product> productRemarkList(Product product);
/**
* 判断是否存在衍生型号
* @param product
* @return
*/
List<Product> productExtList(Product product);
/**
* 获取衍生型号
* @param product
* @return
*/
List<Product> productYsxhList(Product product);
/**
* 判断是否存在截面
* @param product
* @return
*/
List<Product> judgesection(Product product);
/**
* 获取截面
* @param product
* @return
*/
List<Product> productJmList(Product product);
/**
* 查询数据
* @param product
* @return
*/
List<Product> searchData(Product product);
/**
* 点击查询按钮查询数据
* @param name_0
* @param model
* @return
*/
List<Product> handleSearchData(String name_0,String model);
}

View File

@ -0,0 +1,103 @@
package com.ruoyi.redBook.service.impl;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.mapper.OARedBookMapper;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 红本管理Service业务层处理
*
* @author ruoyi
* @date 2024-02-28
*/
@Service
public class RedBookServiceImpl implements IRedBookService
{
@Autowired
private OARedBookMapper oaRedBookMapper;
/**
* 获取目录
* @param product
* @return
*/
@Override
public List<Product> productModelList(Product product) {
return oaRedBookMapper.productModelList(product);
}
/**
* 获取备注信息
* @param product
* @return
*/
@Override
public List<Product> productRemarkList(Product product) {
return oaRedBookMapper.productRemarkList(product);
}
/**
* 判断是否存在衍生型号
* @param product
* @return
*/
@Override
public List<Product> productExtList(Product product) {
return oaRedBookMapper.productExtList(product);
}
/**
* 获取衍生型号
* @param product
* @return
*/
@Override
public List<Product> productYsxhList(Product product) {
return oaRedBookMapper.productYsxhList(product);
}
/**
* 判断是否存在截面
* @param product
* @return
*/
@Override
public List<Product> judgesection(Product product) {
return oaRedBookMapper.judgesection(product);
}
/**
* 获取截面
* @param product
* @return
*/
@Override
public List<Product> productJmList(Product product) {
return oaRedBookMapper.productJmList(product);
}
/**
* 查询数据
* @param product
* @return
*/
@Override
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

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.redBook.mapper.OARedBookMapper">
<select id="productModelList" parameterType="Product" resultType="Product">
select uid_0,name_0,isnull(example_0,'') example_0
from rb_productType
where web_show_0=1
<if test="uid_0 != null and uid_0 != ''">
and puid_0 = #{uid_0}
</if>
<if test="uid_0 == null or uid_0 == ''">
and puid_0 = 0
</if>
order by order_0
</select>
<select id="productRemarkList" parameterType="Product" resultType="Product">
select type_uid_0,remark_0 from [rb_productRemark] where type_uid_0 = #{uid_0}
</select>
<select id="productExtList" parameterType="Product" resultType="Product">
select model_ext_0 as name_0 from rb_productType A
inner join [rb_material_redbook_ext] B on A.name_0=B.model_0
where A.uid_0 = #{uid_0} and B.show_0=1
</select>
<select id="productYsxhList" parameterType="Product" resultType="Product">
select #{uid_0} uid_0,name_0 from (
select name_0,1 order_0 from rb_productType where uid_0 = #{uid_0}
union all
select model_ext_0 as name_0,B.order_0
from rb_productType A
inner join [rb_material_redbook_ext] B on A.name_0=B.model_0
where A.uid_0 = #{uid_0} and B.show_0=1 and isnull(B.type_uid_0,0)=0
union all
select model_ext_0 as name_0,B.order_0
from rb_productType A
inner join [rb_material_redbook_ext] B on A.uid_0=B.type_uid_0
where A.uid_0 = #{uid_0} and B.show_0=1
) A order by order_0
</select>
<select id="judgesection" parameterType="Product" resultType="Product">
select A.uid_0,A.name_0,cast(cast(B.截面 as float) as nvarchar(20)) 截面
from rb_productType A
left join p_section B on A.uid_0=B.type_uid_0
where A.uid_0 = #{uid_0} and 截面 is not null order by A.name_0,B.截面
</select>
<select id="productJmList" parameterType="Product" resultType="Product">
select A.uid_0,A.name_0,cast(cast(B.截面 as float) as nvarchar(20)) section
from rb_productType A
left join p_section B on A.uid_0=B.type_uid_0
where A.uid_0 = #{uid_0} and B.model_0 = #{name_0} and 截面 is not null order by A.name_0,B.截面
</select>
<select id="searchData" parameterType="Product" resultType="Product">
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 and A.type_uid_0 = #{uid_0}
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

@ -0,0 +1,104 @@
import request from '@/utils/request'
// 金额计算
export function toDecimal(x){
let f = parseFloat(x);
if (isNaN(f)) {
return;
}
f = Math.round(x*100)/100;
return f;
}
// 获取目录
export function productList(query) {
return request({
url: '/redBook/redBook/productList',
method: 'get',
params: query
})
}
// 获取备注信息
export function productRemarkList(query) {
return request({
url: '/redBook/redBook/productRemarkList',
method: 'get',
params: query
})
}
// 获取型号
export function productXinghList(query) {
return request({
url: '/redBook/redBook/productXinghList',
method: 'get',
params: query
})
}
// 判断是否为父节点,如果有说明下面还有子类显示,如果没有则直接显示衍生型号
export function judgeparent(query) {
return request({
url: '/redBook/redBook/judgeparent',
method: 'get',
params: query
})
}
// 获取子类
export function productZlList(query) {
return request({
url: '/redBook/redBook/productZlList',
method: 'get',
params: query
})
}
// 判断是否存在衍生型号
export function productYsxhListCheck(query) {
return request({
url: '/redBook/redBook/productYsxhListCheck',
method: 'get',
params: query
})
}
// 获取衍生型号
export function productYsxhList(query) {
return request({
url: '/redBook/redBook/productYsxhList',
method: 'get',
params: query
})
}
// 判断是否存在截面
export function productJmListCheck(query) {
return request({
url: '/redBook/redBook/productJmListCheck',
method: 'get',
params: query
})
}
// 获取截面
export function productJmList(query) {
return request({
url: '/redBook/redBook/productJmList',
method: 'get',
params: query
})
}
//查询数据
export function searchData(query) {
return request({
url: '/redBook/redBook/searchData',
method: 'get',
params: query
})
}
//点击查询按钮查询数据
export function handleSearchData(query) {
return request({
url: '/redBook/redBook/handleSearchData',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,591 @@
<template>
<div class="app-container">
<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-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-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-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-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-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="180"/>
<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="stu"/>
</el-table>
<pagination
v-show="searchResultTotal>0"
:total="searchResultTotal"
:page.sync="searchResultCurrentPage"
:limit.sync="searchResultPageSize"
@size-change="handleSearchResultSizeChange"
@current-change="handleSearchResultCurrentChange"
/>
</el-card>
</el-col>
<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 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','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="型号" 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="60"/>
<el-table-column label="一次折扣" align="center" prop="percent" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.percent" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="二次折扣" align="center" prop="percent2" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.percent2" @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">
<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>
<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>
</el-form>
</div>
</template>
<style>
/* 设置间距 */
.block {
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,handleSearchData} from "@/api/redBook/redBook";
export default {
name: "productSelect",
data() {
return {
//
scrollableHeight:null,
//
tableHeight:null,
//
expandedIndex: -1, // -1
id: 1,
//
queryParams: {},
//tag
selectedModelTag:"",
selectedModelUid:"",
//tag
selectedXinghTag:"",
selectedXinghUid:"",
//tag
selectedZlTag:"",
selectedZlUid:"",
//tag
selectedYsxhTag:"",
selectedYsxhUid:"",
//tag
selectedJmTag:"",
//
modelList: [],
//
showRemarkList: false,
remarkList: [],
//
showXinghList: false,
xinghList: [],
//
showZlList: false,
ZlList: [],
//
showYsxhList: false,
ysxhList: [],
//
showJmList: false,
jmList: [],
/**==============查询结果========================= */
//
searchResultLoading: false,
//
searchResultTotal: 0,
searchResultCurrentPage: 1,
searchResultPageSize: 10,
searchResultData: [],
/**==============已选择结果========================= */
//
selectedResultTotal: 0,
selectedResultCurrentPage: 1,
selectedResultPageSize: 5,
selectedResultData: [],
//
perc: 0.8,
perc2: '',
//
form: {}
}
},
created() {
this.productList();
},
mounted(){
/*设置内容高度*/
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) {
this.showRemarkList = false,
this.remarkList = [],
this.selectedXinghTag = '';
this.showXinghList = false,
this.xinghList = [],
this.selectedZlTag = '';
this.showZlList = false,
this.ZlList = [],
this.selectedYsxhTag = '';
this.showYsxhList = false,
this.ysxhList = [],
this.selectedJmTag = '';
this.showJmList = false,
this.jmList = [],
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
this.selectedModelTag = item.name_0;
console.log(this.selectedModelTag)
//
this.productRemarkList(item.uid_0)
//
this.productXinghList(item.uid_0)
},
//
productList() {
productList().then(response => {
console.log(response)
this.modelList = response;
});
},
//
productRemarkList(sid) {
this.params = {uid_0: sid}
productRemarkList(this.params).then(response => {
this.remarkList = response;
this.showRemarkList = this.remarkList.length > 0 ? true : false
});
},
//
productXinghList(sid) {
this.params = {uid_0: sid}
productXinghList(this.params).then(response => {
this.xinghList = response;
this.showXinghList = this.xinghList.length > 0 ? true : false
});
},
//
selXinghTag(item) {
this.selectedZlTag = '';
this.showZlList = false,
this.ZlList = [],
this.selectedYsxhTag = '';
this.showYsxhList = false,
this.ysxhList = [],
this.selectedJmTag = '';
this.showJmList = false,
this.jmList = [],
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
this.selectedXinghTag = item.name_0;
console.log(this.selectedXinghTag)
//
this.judgeparent(item)
},
//
judgeparent(item) {
this.params = {uid_0: item.uid_0}
judgeparent(this.params).then(response => {
if (response) {//
this.productZlList(item.uid_0)
} else {//
this.productYsxhListCheck(item.uid_0, item.name_0)
}
});
},
//
productZlList(sid) {
this.params = {uid_0: sid}
productZlList(this.params).then(response => {
this.zlList = response;
this.showZlList = this.zlList.length > 0 ? true : false
});
},
//
productYsxhListCheck(sid, name) {
this.params = {uid_0: sid}
productYsxhListCheck(this.params).then(response => {
if (response) {//
this.productYsxhList(sid, name)
} else {
this.selectedYsxhUid = sid;
this.selectedYsxhTag = name;
//
this.productJmListCheck(sid, 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
});
},
//
selZlTag(item) {
this.selectedYsxhTag = '';
this.showYsxhList = false,
this.ysxhList = [],
this.selectedJmTag = '';
this.showJmList = false,
this.jmList = [],
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
this.selectedZlTag = item.name_0;
console.log(this.selectedZlTag)
this.productYsxhListCheck(item.uid_0, item.name_0)
},
//
selYsxhTag(item) {
this.selectedJmTag = '';
this.selectedYsxhUid = item.uid_0;
this.showJmList = false,
this.jmList = [],
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
this.selectedYsxhTag = item.name_0;
console.log(this.selectedYsxhTag)
this.productJmListCheck(item.uid_0, item.name_0)
},
//
productJmListCheck(sid, name) {
this.params = {uid_0: sid}
productJmListCheck(this.params).then(response => {
if (response) {//
this.productJmList(sid, name)
} else {
//
console.log("结果表格输出")
//TODO
}
});
},
//
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
});
},
//
selJmTag(item) {
this.selectedJmTag = item.section;
console.log(this.selectedYsxhTag)
console.log(this.selectedYsxhUid)
this.searchResultCurrentPage = 1,
this.searchResultPageSize = 10,
this.searchResultData = [],
this.searchResultLoading = true;
this.searchData(this.selectedYsxhUid, item.section)
},
//
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;
this.searchResultTotal = this.searchResultData.length;
this.searchResultCurrentPage = 1;
this.searchResultLoading = false;
});
},
//
handleRowDblclick(row, event, column) {
const name_0 = row.name_0;
const voltage = row.voltage;
const price = row.price;
const stu = row.stu;
const percent = '0.8';
const percent2 = '';
const count = '1';
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) {
this.selectedResultData.splice(index, 1)
this.selectedResultTotal = this.selectedResultData.length;
},
/** 切换每页显示条数--查询结果 */
handleSearchResultSizeChange(val) {
this.searchResultPageSize = val;
this.searchResultCurrentPage = 1;
},
/** 页码选择--查询结果 */
handleSearchResultCurrentChange(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(){
//
let div = document.getElementById("scroll")
div.scrollTop = div.scrollHeight
},
computed: {
//
searchResultPagedData() {
console.log(this.searchResultData)
const startIndex = (this.searchResultCurrentPage - 1) * this.searchResultPageSize;
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>
<style scoped>
</style>