parent
fcd49fcc1c
commit
99b0eee9d4
|
|
@ -0,0 +1,48 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
//获取仓库信息列表
|
||||||
|
export function getWareInfoList(parms) {
|
||||||
|
return request({
|
||||||
|
url: '/mall-ware/ware/wareinfo/list',
|
||||||
|
method: 'get',
|
||||||
|
params: parms
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除仓库信息
|
||||||
|
export function delWareInfo(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/mall-ware/ware/wareinfo/delete',
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取仓库信息详情
|
||||||
|
export function getWareInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: `/mall-ware/ware/wareinfo/info/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//保存仓库信息
|
||||||
|
export function saveWareInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: `/mall-ware/ware/wareinfo/save`,
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改仓库信息
|
||||||
|
export function editWareInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: `/mall-ware/ware/wareinfo/update`,
|
||||||
|
method: 'put',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<spuinfo :catId="catId"></spuinfo>
|
<spuinfo :catId="catId" ref="spuInfo"></spuinfo>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -75,6 +75,9 @@ export default {
|
||||||
// this.catelogPath= []
|
// this.catelogPath= []
|
||||||
this.$bus.$emit('clearCategoryCascader', [])
|
this.$bus.$emit('clearCategoryCascader', [])
|
||||||
this.$bus.$emit('clearBrandSelect', [])
|
this.$bus.$emit('clearBrandSelect', [])
|
||||||
|
|
||||||
|
//调用子组件重置方法
|
||||||
|
this.$refs.spuInfo.rest()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,12 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//重置值
|
||||||
|
rest() {
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
width="500px"
|
||||||
|
:title="!dataForm.id ? '新增' : '修改'"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:visible.sync="visible">
|
||||||
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
|
||||||
|
label-width="80px">
|
||||||
|
<el-form-item label="仓库名" prop="name">
|
||||||
|
<el-input v-model="dataForm.name" placeholder="仓库名"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="仓库地址" prop="address">
|
||||||
|
<el-input v-model="dataForm.address" placeholder="仓库地址"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="区域编码" prop="areacode">
|
||||||
|
<el-input v-model="dataForm.areacode" placeholder="区域编码"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {editWareInfo, getWareInfo, saveWareInfo} from "@/api/mall/ware/ware-info";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Ware-info-add-update",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
dataForm: {
|
||||||
|
name: '',
|
||||||
|
address: '',
|
||||||
|
areacode: ''
|
||||||
|
},
|
||||||
|
dataRule: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: '仓库名不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
address: [
|
||||||
|
{required: true, message: '仓库地址不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
areacode: [
|
||||||
|
{required: true, message: '区域编码不能为空', trigger: 'blur'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
this.dataForm.id = id
|
||||||
|
this.visible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['dataForm'].resetFields()
|
||||||
|
if (this.dataForm.id) {
|
||||||
|
getWareInfo(this.dataForm.id).then(res => {
|
||||||
|
this.dataForm = res.wareInfo
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 表单提交
|
||||||
|
dataFormSubmit() {
|
||||||
|
this.$refs['dataForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (!this.dataForm.id) {
|
||||||
|
saveWareInfo(this.dataForm).then(res => {
|
||||||
|
this.$modal.notifySuccess("添加成功")
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
editWareInfo(this.dataForm).then(res => {
|
||||||
|
this.$modal.notifySuccess("修改成功")
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,173 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
|
<el-form-item>
|
||||||
|
<el-input v-model="dataForm.key" placeholder="请输入仓库名、仓库地址、区域编码等" clearable style="width: 300px"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button-group>
|
||||||
|
<el-button @click="getDataList()" size="mini">查询</el-button>
|
||||||
|
<el-button type="primary" @click="addOrUpdateHandle()" size="mini">新增</el-button>
|
||||||
|
<el-button type="danger" @click="deleteHandle()"
|
||||||
|
:disabled="dataListSelections.length <= 0" size="mini">批量删除
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-button-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table
|
||||||
|
:data="dataList"
|
||||||
|
border
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
@selection-change="selectionChangeHandle"
|
||||||
|
style="width: 100%;">
|
||||||
|
<el-table-column
|
||||||
|
type="selection"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
width="50">
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
prop="name"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
label="仓库名">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="address"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
label="仓库地址">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
prop="areacode"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
:show-overflow-tooltip="true"
|
||||||
|
label="区域编码">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
fixed="right"
|
||||||
|
header-align="center"
|
||||||
|
align="center"
|
||||||
|
width="150"
|
||||||
|
label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||||
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
:current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="totalPage"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper">
|
||||||
|
</el-pagination>
|
||||||
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import AddOrUpdate from './wareinfo-add-or-update'
|
||||||
|
import {delWareInfo, getWareInfoList} from "@/api/mall/ware/ware-info";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Ware-info",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataForm: {
|
||||||
|
key: ''
|
||||||
|
},
|
||||||
|
dataList: [],
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
AddOrUpdate
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
'page': this.pageIndex,
|
||||||
|
'limit': this.pageSize,
|
||||||
|
'key': this.dataForm.key
|
||||||
|
}
|
||||||
|
getWareInfoList(params).then(res => {
|
||||||
|
this.dataList = res.page.list
|
||||||
|
this.totalPage = res.page.totalCount
|
||||||
|
this.dataListLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val
|
||||||
|
this.pageIndex = 1
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val
|
||||||
|
this.getDataList()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(id) {
|
||||||
|
this.addOrUpdateVisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.addOrUpdate.init(id)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
deleteHandle(id) {
|
||||||
|
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||||
|
return item.id
|
||||||
|
})
|
||||||
|
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
delWareInfo(ids).then(res => {
|
||||||
|
this.$modal.notifySuccess("删除成功")
|
||||||
|
this.getDataList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dataForm = {}
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -4,6 +4,8 @@ import com.xjs.mall.ware.entity.WareInfoEntity;
|
||||||
import com.xjs.mall.ware.service.WareInfoService;
|
import com.xjs.mall.ware.service.WareInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.mall.other.R;
|
import com.xjs.mall.other.R;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
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.*;
|
||||||
|
|
||||||
|
|
@ -11,16 +13,16 @@ import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仓库信息
|
* 仓库信息
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 09:56:19
|
* @since 2022-03-15 09:56:19
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("ware/wareinfo")
|
@RequestMapping("ware/wareinfo")
|
||||||
|
@Api(tags = "商城-仓库-仓库信息")
|
||||||
public class WareInfoController {
|
public class WareInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WareInfoService wareInfoService;
|
private WareInfoService wareInfoService;
|
||||||
|
|
@ -28,8 +30,9 @@ public class WareInfoController {
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@GetMapping("/list")
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
@ApiOperation("列表")
|
||||||
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
PageUtils page = wareInfoService.queryPage(params);
|
PageUtils page = wareInfoService.queryPage(params);
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
return R.ok().put("page", page);
|
||||||
|
|
@ -39,9 +42,10 @@ public class WareInfoController {
|
||||||
/**
|
/**
|
||||||
* 信息
|
* 信息
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/info/{id}")
|
@GetMapping("/info/{id}")
|
||||||
public R info(@PathVariable("id") Long id){
|
@ApiOperation("信息")
|
||||||
WareInfoEntity wareInfo = wareInfoService.getById(id);
|
public R info(@PathVariable("id") Long id) {
|
||||||
|
WareInfoEntity wareInfo = wareInfoService.getById(id);
|
||||||
|
|
||||||
return R.ok().put("wareInfo", wareInfo);
|
return R.ok().put("wareInfo", wareInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -49,9 +53,10 @@ public class WareInfoController {
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/save")
|
@PostMapping("/save")
|
||||||
public R save(@RequestBody WareInfoEntity wareInfo){
|
@ApiOperation("保存")
|
||||||
wareInfoService.save(wareInfo);
|
public R save(@RequestBody WareInfoEntity wareInfo) {
|
||||||
|
wareInfoService.save(wareInfo);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -59,9 +64,10 @@ public class WareInfoController {
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/update")
|
@PutMapping("/update")
|
||||||
public R update(@RequestBody WareInfoEntity wareInfo){
|
@ApiOperation("修改")
|
||||||
wareInfoService.updateById(wareInfo);
|
public R update(@RequestBody WareInfoEntity wareInfo) {
|
||||||
|
wareInfoService.updateById(wareInfo);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -69,9 +75,10 @@ public class WareInfoController {
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
public R delete(@RequestBody Long[] ids){
|
@ApiOperation("删除")
|
||||||
wareInfoService.removeByIds(Arrays.asList(ids));
|
public R delete(@RequestBody Long[] ids) {
|
||||||
|
wareInfoService.removeByIds(Arrays.asList(ids));
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.xjs.mall.ware.service.impl;
|
package com.xjs.mall.ware.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.xjs.mall.ware.dao.WareInfoDao;
|
import com.xjs.mall.ware.dao.WareInfoDao;
|
||||||
import com.xjs.mall.ware.entity.WareInfoEntity;
|
import com.xjs.mall.ware.entity.WareInfoEntity;
|
||||||
import com.xjs.mall.ware.service.WareInfoService;
|
import com.xjs.mall.ware.service.WareInfoService;
|
||||||
|
|
@ -18,10 +19,16 @@ public class WareInfoServiceImpl extends ServiceImpl<WareInfoDao, WareInfoEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
IPage<WareInfoEntity> page = this.page(
|
String key = (String) params.get(Query.KEY_NAME);
|
||||||
new Query<WareInfoEntity>().getPage(params),
|
|
||||||
new QueryWrapper<WareInfoEntity>()
|
LambdaQueryWrapper<WareInfoEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
);
|
if (StringUtils.isNotEmpty(key)) {
|
||||||
|
wrapper.like(WareInfoEntity::getName, key).or()
|
||||||
|
.like(WareInfoEntity::getAddress, key).or()
|
||||||
|
.eq(WareInfoEntity::getAreacode, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
IPage<WareInfoEntity> page = this.page(new Query<WareInfoEntity>().getPage(params), wrapper);
|
||||||
|
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue