实现选取地区功能
This commit is contained in:
parent
0401f54b05
commit
b1ea081a75
941
logs/JIAL-ss.log
941
logs/JIAL-ss.log
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,8 @@
|
|||
2024-02-18 09:23:11.462 INFO 14136 --- [main] com.JN.JNApplication : Starting JNApplication using Java 1.8.0_171 on DESKTOP-OG1MRMC with PID 14136 (D:\JavaProject\JNDemo\target\classes started by Administrator in D:\JavaProject\JNDemo)
|
||||
2024-02-18 09:23:11.462 INFO 14136 --- [main] com.JN.JNApplication : The following profiles are active: JN
|
||||
2024-02-18 09:23:13.736 WARN 14136 --- [Druid-ConnectionPool-Create-696870185] c.m.s.jdbc.internals.TDS.Channel : TLSv1 was negotiated. Please update server and client to use TLSv1.2 at minimum.
|
||||
2024-02-18 09:23:15.269 INFO 14136 --- [main] com.JN.config.WebMvcConfig : 扩展消息转换器...
|
||||
2024-02-18 09:23:15.285 INFO 14136 --- [main] com.JN.config.WebMvcConfig : 开始进行静态资源映射...
|
||||
2024-02-18 09:23:15.425 WARN 14136 --- [main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
|
||||
2024-02-18 09:23:15.675 INFO 14136 --- [main] com.JN.JNApplication : Started JNApplication in 4.715 seconds (JVM running for 6.44)
|
||||
2024-02-18 09:23:15.675 INFO 14136 --- [main] com.JN.JNApplication : 项目启动成功...
|
|
@ -0,0 +1,39 @@
|
|||
package com.JN.demo.zmquotation.controller;
|
||||
|
||||
import com.JN.common.R;
|
||||
import com.JN.demo.zmquotation.dto.RegionDto;
|
||||
import com.JN.demo.zmquotation.service.RegionService;
|
||||
import lombok.experimental.PackagePrivate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName ZMController
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2024/2/19 8:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/zmquotation")
|
||||
public class ZMController {
|
||||
@Autowired
|
||||
RegionService regionService;
|
||||
|
||||
@PostMapping("/regionList")
|
||||
public R<List<RegionDto>> queryRegionList(@RequestParam("regionName") String regionName){
|
||||
|
||||
List<RegionDto> regionList = regionService.queryRegionListByName(regionName);
|
||||
|
||||
log.info("查询到的地区列表结果是:{}", regionList);
|
||||
|
||||
return R.success(regionList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.JN.demo.zmquotation.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @ClassName RegionDto
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2024/2/19 10:40
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class RegionDto implements Serializable {
|
||||
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private Integer kilometers;
|
||||
|
||||
private BigDecimal price01;
|
||||
|
||||
private BigDecimal price02;
|
||||
|
||||
private BigDecimal price03;
|
||||
|
||||
private BigDecimal price04;
|
||||
|
||||
private BigDecimal price05;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.JN.demo.zmquotation.mapper;
|
||||
|
||||
import com.JN.demo.zmquotation.dto.RegionDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName RegionMapper
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2024/2/19 10:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RegionMapper {
|
||||
@Select("with temp as(\n" +
|
||||
"select pz_place_uid_0,price_0t_5t,price_5t_10t,price_10t_25t,price_25t_100t,price_100t from c_pz_price where date_0=(select max(date_0) from c_pz_price) \n" +
|
||||
") select distinct a.sheng_0 as province,a.shi_0 as city,a.qu_0 as district,a.km_0 as kilometers,\n" +
|
||||
"b.price_0t_5t as price_01,b.price_5t_10t as price_02,b.price_10t_25t as price_03,b.price_25t_100t as price_04,b.price_100t as price_05\n" +
|
||||
"from c_pz_place2019 a left join temp b on a.id_0 = b.pz_place_uid_0 where a.qu_0 not in \n" +
|
||||
"('江阴市','金坛区','溧阳市','宜兴市') and (sheng_0 like '%${regionName}%' or shi_0 like '%${regionName}%' or qu_0 like '%${regionName}%')")
|
||||
List<RegionDto> queryRegionListByName(String regionName);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.JN.demo.zmquotation.service;
|
||||
|
||||
import com.JN.demo.zmquotation.dto.RegionDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName RegionService
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2024/2/19 10:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface RegionService {
|
||||
|
||||
List<RegionDto> queryRegionListByName(String regionName);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.JN.demo.zmquotation.service.impl;
|
||||
|
||||
import com.JN.demo.zmquotation.dto.RegionDto;
|
||||
import com.JN.demo.zmquotation.mapper.RegionMapper;
|
||||
import com.JN.demo.zmquotation.service.RegionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName RegionServiceImpl
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2024/2/19 10:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class RegionServiceImpl implements RegionService {
|
||||
|
||||
@Autowired
|
||||
RegionMapper regionMapper;
|
||||
|
||||
/**
|
||||
* @title queryRegionListByName
|
||||
* @description 根据输入的地区名称查询地区列表
|
||||
* @author JIAL
|
||||
* @param: regionName
|
||||
* @updateTime 2024/2/19 10:59
|
||||
* @return: java.util.List<com.JN.demo.zmquotation.dto.RegionDto>
|
||||
*/
|
||||
@Override
|
||||
public List<RegionDto> queryRegionListByName(String regionName){
|
||||
return regionMapper.queryRegionListByName(regionName);
|
||||
}
|
||||
}
|
|
@ -2,4 +2,4 @@ spring:
|
|||
thymeleaf:
|
||||
mode: HTML
|
||||
profiles:
|
||||
active: JN
|
||||
active: ZM
|
||||
|
|
|
@ -68,6 +68,17 @@
|
|||
|
||||
}
|
||||
|
||||
.regionTable .el-dialog__header{
|
||||
padding-bottom: 0px;
|
||||
|
||||
}
|
||||
.regionTable .el-dialog__body{
|
||||
padding-top: 0px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.el-table .el-table__cell {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
const queryRegionListByName = (params) => {
|
||||
return $axios({
|
||||
url: '/zmquotation/regionList',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
|
@ -260,25 +260,26 @@
|
|||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog class="regionTable" :visible.sync="dialogRegionVisible" width="882px">
|
||||
<el-form>
|
||||
<el-form-item style="margin: 5px">
|
||||
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
|
||||
</el-input>
|
||||
<el-button type="primary" size="small" @click="searchRegion">查询地区</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-dialog class="regionTable" :visible.sync="dialogRegionVisible" width="932px" >
|
||||
<div slot="title" class="regionTable-title" style="margin: 0px">
|
||||
<el-form>
|
||||
<el-form-item >
|
||||
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
|
||||
</el-input>
|
||||
<el-button type="primary" size="small" @click="searchRegion">查询地区</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table
|
||||
:data="getCurrentPageData"
|
||||
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center'}"
|
||||
:cell-style="{'text-align': 'center', 'padding': '1px 0px 1px 0px'}"
|
||||
:data="getCurrentRegionData"
|
||||
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
|
||||
:cell-style="{'text-align': 'center', 'padding': '0px'}"
|
||||
highlight-current-row
|
||||
border>
|
||||
<el-table-column
|
||||
v-if="false"
|
||||
label="uid"
|
||||
label="序号"
|
||||
type="index"
|
||||
width="100">
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="180"
|
||||
|
@ -310,9 +311,9 @@
|
|||
</el-table>
|
||||
<div style="text-align: center; margin-top: 10px;">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page.sync="currentPage"
|
||||
@size-change="handleRegionSizeChange"
|
||||
@current-change="handleRegionCurrentChange"
|
||||
:current-page.sync="regionCurrentPage"
|
||||
:page-sizes="[10, 20, 30, 40]"
|
||||
:page-size="pageSize"
|
||||
:total="regionTableData.length"
|
||||
|
@ -360,29 +361,21 @@
|
|||
{ kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' },
|
||||
// Add more rows as needed
|
||||
],
|
||||
regionTableData: [
|
||||
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1001', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1002', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1003', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
{uid: '1004', province: '宁夏', city: '银川', district: '西夏区', kilometers: '1700'},
|
||||
],
|
||||
regionTableData: [],
|
||||
price_0t_5t: '',
|
||||
price_5t_10t: '',
|
||||
price_10t_25t: '',
|
||||
price_25t_100t: '',
|
||||
price_100t: '',
|
||||
dialogRegionVisible: false,
|
||||
regionName: '',
|
||||
currentPage: 1,
|
||||
regionCurrentPage: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getCurrentPageData() {
|
||||
const start = (this.currentPage - 1) * this.pageSize;
|
||||
getCurrentRegionData() {
|
||||
const start = (this.regionCurrentPage - 1) * this.pageSize;
|
||||
const end = start + this.pageSize;
|
||||
return this.regionTableData.slice(start, end);
|
||||
},
|
||||
|
@ -414,28 +407,48 @@
|
|||
|
||||
selectedRegion(){
|
||||
this.dialogRegionVisible = true;
|
||||
console.log(this.regionTableData)
|
||||
},
|
||||
|
||||
chooseRegion(row) {
|
||||
this.dialogRegionVisible = false;
|
||||
console.log(row)
|
||||
this.formLabelAlign.province = row.province
|
||||
this.formLabelAlign.city = row.city
|
||||
this.formLabelAlign.district = row.district
|
||||
this.formLabelAlign.kilometers = row.kilometers
|
||||
this.price_0t_5t = row.price01
|
||||
this.price_5t_10t = row.price02
|
||||
this.price_10t_25t = row.price03
|
||||
this.price_25t_100t = row.price04
|
||||
this.price_100t = row.price05
|
||||
|
||||
|
||||
},
|
||||
|
||||
searchRegion(){
|
||||
|
||||
if(this.regionName === ''){
|
||||
this.$message({
|
||||
message: '请输入你要查询的地区名称',
|
||||
type: 'warning'
|
||||
});
|
||||
}else{
|
||||
const params = {
|
||||
regionName : this.regionName
|
||||
}
|
||||
console.log(params)
|
||||
queryRegionListByName(params).then(res => {
|
||||
this.regionTableData = res.data || []
|
||||
}).catch(err => {
|
||||
this.$message.error('请求出错了:' + err)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
handleSizeChange(val) {
|
||||
|
||||
handleRegionSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.currentPage = 1; // 切换每页显示条目数时回到第一页
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
|
||||
handleRegionCurrentChange(val) {
|
||||
this.currentPage = val;
|
||||
},
|
||||
|
||||
|
|
|
@ -2,4 +2,4 @@ spring:
|
|||
thymeleaf:
|
||||
mode: HTML
|
||||
profiles:
|
||||
active: JN
|
||||
active: ZM
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,6 +13,11 @@
|
|||
|
||||
}
|
||||
|
||||
/**找到表头那一行,然后把里面的复选框隐藏掉**/
|
||||
.regionTable .el-table__header-wrapper .el-table__header .el-checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.el-input__inner {
|
||||
height: 30px;
|
||||
/*font-family: Roboto, serif;*/
|
||||
|
@ -58,11 +63,22 @@
|
|||
|
||||
}
|
||||
|
||||
.el-form-item {
|
||||
.form-box .el-form-item {
|
||||
margin: 0px 15px 0px 15px;
|
||||
|
||||
}
|
||||
|
||||
.regionTable .el-dialog__header{
|
||||
padding-bottom: 0px;
|
||||
|
||||
}
|
||||
.regionTable .el-dialog__body{
|
||||
padding-top: 0px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
.el-table .el-table__cell {
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
const queryRegionListByName = (params) => {
|
||||
return $axios({
|
||||
url: '/zmquotation/regionList',
|
||||
method: 'post',
|
||||
params
|
||||
})
|
||||
}
|
|
@ -150,7 +150,7 @@
|
|||
</el-form>
|
||||
</div>
|
||||
<div class="button-box">
|
||||
<el-button type="text">选择地区</el-button>
|
||||
<el-button type="text" @click="selectedRegion">选择地区</el-button>
|
||||
<el-button type="text">添加物料</el-button>
|
||||
<el-button type="text">刷新界面</el-button>
|
||||
<el-button type="text"></el-button>
|
||||
|
@ -260,6 +260,66 @@
|
|||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog class="regionTable" :visible.sync="dialogRegionVisible" width="932px" >
|
||||
<div slot="title" class="regionTable-title" style="margin: 0px">
|
||||
<el-form>
|
||||
<el-form-item >
|
||||
<el-input style="width: 300px; " v-model="regionName" placeholder="请输入地区名称">
|
||||
</el-input>
|
||||
<el-button type="primary" size="small" @click="searchRegion">查询地区</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-table
|
||||
:data="getCurrentRegionData"
|
||||
:header-cell-style="{ background: '#eef1f6', color: '#606266', 'text-align': 'center', 'padding': '0px'}"
|
||||
:cell-style="{'text-align': 'center', 'padding': '0px'}"
|
||||
highlight-current-row
|
||||
border>
|
||||
<el-table-column
|
||||
label="序号"
|
||||
type="index"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="180"
|
||||
prop="province"
|
||||
label="省">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="180"
|
||||
prop="city"
|
||||
label="市">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="200"
|
||||
prop="district"
|
||||
label="区">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="200"
|
||||
prop="kilometers"
|
||||
label="公里数">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
width="80"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button @click="chooseRegion(scope.row)" style="color: blue;" type="text">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="text-align: center; margin-top: 10px;">
|
||||
<el-pagination
|
||||
@size-change="handleRegionSizeChange"
|
||||
@current-change="handleRegionCurrentChange"
|
||||
:current-page.sync="regionCurrentPage"
|
||||
:page-sizes="[10, 20, 30, 40]"
|
||||
:page-size="pageSize"
|
||||
:total="regionTableData.length"
|
||||
></el-pagination>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -295,18 +355,30 @@
|
|||
weightTotal: '', /*重量合计*/
|
||||
totalFactoryAmount: '', /*厂价金额合计*/
|
||||
totalActualAmount: '', /*实际金额合计*/
|
||||
|
||||
|
||||
},
|
||||
tableData: [
|
||||
{ kunnr1: '001', kunnr2: '002', kunnr3: '003', kunnr4: '004', kunnr5: '005', kunnr6: '006', kunnr7: '007', kunnr8: '008' },
|
||||
{ kunnr1: '101', kunnr2: '102', kunnr3: '103', kunnr4: '104', kunnr5: '105', kunnr6: '106', kunnr7: '107', kunnr8: '108' },
|
||||
// Add more rows as needed
|
||||
],
|
||||
regionTableData: [],
|
||||
price_0t_5t: '',
|
||||
price_5t_10t: '',
|
||||
price_10t_25t: '',
|
||||
price_25t_100t: '',
|
||||
price_100t: '',
|
||||
dialogRegionVisible: false,
|
||||
regionName: '',
|
||||
regionCurrentPage: 1,
|
||||
pageSize: 10,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
getCurrentRegionData() {
|
||||
const start = (this.regionCurrentPage - 1) * this.pageSize;
|
||||
const end = start + this.pageSize;
|
||||
return this.regionTableData.slice(start, end);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
|
@ -331,8 +403,54 @@
|
|||
|
||||
handleDeleteClick(index){
|
||||
this.tableData.splice(index, 1)
|
||||
}
|
||||
},
|
||||
|
||||
selectedRegion(){
|
||||
this.dialogRegionVisible = true;
|
||||
},
|
||||
|
||||
chooseRegion(row) {
|
||||
this.dialogRegionVisible = false;
|
||||
this.formLabelAlign.province = row.province
|
||||
this.formLabelAlign.city = row.city
|
||||
this.formLabelAlign.district = row.district
|
||||
this.formLabelAlign.kilometers = row.kilometers
|
||||
this.price_0t_5t = row.price01
|
||||
this.price_5t_10t = row.price02
|
||||
this.price_10t_25t = row.price03
|
||||
this.price_25t_100t = row.price04
|
||||
this.price_100t = row.price05
|
||||
|
||||
|
||||
},
|
||||
searchRegion(){
|
||||
if(this.regionName === ''){
|
||||
this.$message({
|
||||
message: '请输入你要查询的地区名称',
|
||||
type: 'warning'
|
||||
});
|
||||
}else{
|
||||
const params = {
|
||||
regionName : this.regionName
|
||||
}
|
||||
console.log(params)
|
||||
queryRegionListByName(params).then(res => {
|
||||
this.regionTableData = res.data || []
|
||||
}).catch(err => {
|
||||
this.$message.error('请求出错了:' + err)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
handleRegionSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.currentPage = 1; // 切换每页显示条目数时回到第一页
|
||||
},
|
||||
|
||||
handleRegionCurrentChange(val) {
|
||||
this.currentPage = val;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue