'12'
This commit is contained in:
parent
30dfb3b829
commit
c923a46bca
|
@ -0,0 +1,158 @@
|
|||
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.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.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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
@ -17,6 +17,11 @@ public enum DataSourceType
|
|||
*/
|
||||
REDBOOK,
|
||||
|
||||
/**
|
||||
* 红本数据库-OA单点登录数据源
|
||||
*/
|
||||
OAREDBOOK,
|
||||
|
||||
/**
|
||||
* 江南全要素报价数据库
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
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 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);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
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);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<?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>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,86 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 获取目录
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,415 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form label-width="100px">
|
||||
<el-row style="letter-spacing: 3px;" :gutter="5">
|
||||
<el-col :span="12">
|
||||
<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-form-item>
|
||||
<el-form-item label="备注:" v-if="showRemarkList">
|
||||
<div v-for="(item, index) in remarkList" :key="index" style="line-height: 25px">
|
||||
{{index+1}}、{{item.remark_0}}
|
||||
</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-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-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-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-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="voltage" width="120"/>
|
||||
<el-table-column label="红本价(元)" align="center" prop="price" width="120"/>
|
||||
<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="12">
|
||||
<el-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
|
||||
<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>%
|
||||
</span>
|
||||
<el-table width="100%;" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
|
||||
<el-table-column 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="price" width="100"/>
|
||||
<el-table-column label="单位" align="center" prop="stu" width="80"/>
|
||||
<el-table-column label="调价比例" align="center" prop="percent" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.percent"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" prop="setPrice" width="100"/>
|
||||
<el-table-column label="数量调整" align="center" prop="count" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.count"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总价" align="center" prop="allPrice" width="100"/>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
<style>
|
||||
.block {
|
||||
margin: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
/*卡片内容滚动条设置*/
|
||||
.scrollable::-webkit-scrollbar {
|
||||
display: none; /* 对于Webkit浏览器 */
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
import { productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData} from "@/api/redBook/redBook";
|
||||
|
||||
export default {
|
||||
name: "productSelect",
|
||||
data() {
|
||||
return {
|
||||
//内容高度
|
||||
scrollableHeight:null,
|
||||
//选中的目录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: [],
|
||||
|
||||
//已选择的数据
|
||||
selectedResultData: [],
|
||||
|
||||
//折扣率 初始值
|
||||
perc: 0,
|
||||
perc2: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.productList();
|
||||
},
|
||||
mounted(){
|
||||
/*设置内容高度*/
|
||||
this.scrollableHeight = (window.innerHeight - 130) + 'px';
|
||||
},
|
||||
methods: {
|
||||
//目录选择
|
||||
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 price = row.price;
|
||||
const percent = '1';
|
||||
const count = '1';
|
||||
row.percent = percent;
|
||||
row.setPrice = price;
|
||||
row.count = count;
|
||||
const allPrice = this.toDecimal(count*price);
|
||||
row.allPrice = allPrice;
|
||||
this.selectedResultData.push(row)
|
||||
},
|
||||
toDecimal(x){
|
||||
var f = parseFloat(x);
|
||||
if (isNaN(f)) {
|
||||
return;
|
||||
}
|
||||
f = Math.round(x*100)/100;
|
||||
return f;
|
||||
},
|
||||
|
||||
//删除已选数据
|
||||
handleDeleteClick(index){
|
||||
this.selectedResultData.splice(index, 1)
|
||||
},
|
||||
|
||||
/** 切换每页显示条数 */
|
||||
handleSearchResultSizeChange(val) {
|
||||
this.bankCodePageSize = val;
|
||||
this.bankCodeCurrentPage = 1;
|
||||
},
|
||||
/** 页码选择 */
|
||||
handleSearchResultCurrentChange(val) {
|
||||
this.bankCodeCurrentPage = val;
|
||||
},
|
||||
},
|
||||
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);
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue