9 changed files with 809 additions and 94 deletions
@ -0,0 +1,84 @@ |
|||
import request from '@/utils/request' |
|||
// 仓库区域 接口
|
|||
export default { |
|||
|
|||
// 查询分页列表
|
|||
listPage: function(params) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/listPage', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 区域查询
|
|||
getAllWarehousezone: function(params) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/listAll', |
|||
method: 'post', |
|||
data: params, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
// 根据仓库sid查询区域
|
|||
getAllWarehousezoneBysid: function(params) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/selectAll', |
|||
method: 'get', |
|||
params: params, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
|
|||
// 修改是否可用状态
|
|||
updateIsEnable: function(sid, isEnable) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/updateIsEnable/' + sid + "/" + isEnable |
|||
}); |
|||
}, |
|||
|
|||
|
|||
// 新增、保存
|
|||
saveWarehousezone: function(data) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/saveOrUpdate', |
|||
method: 'post', |
|||
data: data, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}); |
|||
}, |
|||
|
|||
// 初始化
|
|||
initWarehousezone: function(data) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/initialization/' + data, |
|||
method: 'get' |
|||
}); |
|||
}, |
|||
|
|||
|
|||
// 区域-- 删除
|
|||
deleteBySids: function(data) { |
|||
return request({ |
|||
url: '/wms/apiadmin/base/wmswarehousezone/delBySids', |
|||
method: 'DELETE', |
|||
data: data, |
|||
headers: { |
|||
'Content-Type': 'application/json' |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
} |
@ -0,0 +1,337 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<div v-show="viewState == 1"> |
|||
<button-bar ref="btnbar" view-title="仓库区域管理" :btndisabled="btndisabled" @btnhandle="btnHandle" /> |
|||
<div class="main-content"> |
|||
<div class="searchcon"> |
|||
<el-button size="small" class="searchbtn" @click="clicksearchShow"> |
|||
{{ searchxianshitit }} |
|||
</el-button> |
|||
<div v-show="isSearchShow" class="search"> |
|||
<el-form :inline="true" class="tab-header"> |
|||
<el-form-item label="区域名称"> |
|||
<el-input v-model="queryParams.params.name" placeholder="" clearable /> |
|||
</el-form-item> |
|||
<el-form-item label="区域编码"> |
|||
<el-input v-model="queryParams.params.code" placeholder="" clearable /> |
|||
</el-form-item> |
|||
<el-form-item label="所属仓库"> |
|||
<el-select v-model="queryParams.params.warehouseSid" placeholder="所属仓库"> |
|||
<el-option v-for="item in warehouseList" :key="item.sid" :label="item.warehouseName" |
|||
:value="item.sid" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
|
|||
</el-form> |
|||
<div class="btn" style="text-align: center;"> |
|||
<el-button type="primary" size="small" icon="el-icon-search" @click="dosearch">查询</el-button> |
|||
<el-button type="primary" size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- Start 项目列表头部 --> |
|||
<div class="listtop"> |
|||
<div class="tit">仓库区域列表</div> |
|||
</div> |
|||
<!-- End 项目列表头部 --> |
|||
<!-- Start 项目列表 --> |
|||
<div class=""> |
|||
<el-table v-loading="tableLoading" :data="dataList" border style="width: 100%" |
|||
@selection-change="selectionLineChangeHandle"> |
|||
<el-table-column fixed width="50" type="selection" align="center" /> |
|||
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center" /> |
|||
<!-- <el-table-column label="操作" align="center" width="100"> |
|||
<template slot-scope="scope"> |
|||
<el-button type="primary" size="mini" @click="toRelevancy(scope.row)">详情</el-button> |
|||
</template> |
|||
</el-table-column> --> |
|||
<el-table-column label="是否可用" align="center" width="140"> |
|||
<template slot-scope="scope"> |
|||
<el-switch v-model="scope.row.isEnable" active-text="是" inactive-text="否" active-value="1" |
|||
inactive-value="0" @change="enableChange(scope.row.sid,scope.row.isEnable)" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="zoneName" label="区域名称" align="center" /> |
|||
<el-table-column prop="zoneCode" label="区域编码" align="center" /> |
|||
<el-table-column prop="volume" label="区域面积" align="center" /> |
|||
<el-table-column prop="unit" label="计量单位" align="center" /> |
|||
<el-table-column prop="remarks" label="备注" align="center" /> |
|||
<el-table-column prop="warehouseName" label="所属仓库" align="center" /> |
|||
</el-table> |
|||
</div> |
|||
<!-- End 项目列表 --> |
|||
<div class="pages"> |
|||
<div class="tit" /> |
|||
<!-- 翻页 --> |
|||
<pagination v-show="dataList.length > 0" :total="queryParams.total" :page.sync="queryParams.current" |
|||
:limit.sync="queryParams.size" class="pagination" @pagination="loadList" /> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- End 查询和其列表部分 --> |
|||
<!-- 新增修改部分组件 --> |
|||
<divAdd v-show="viewState == 2 || viewState == 3" ref="divadd" @doback="resetState" @reloadlist="loadList" /> |
|||
<!-- <divInfo v-show="viewState == 4" ref="divinfo" @doback="resetState" @reloadlist="loadList" /> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/warehouse/warehouseZone.js' |
|||
import req2 from '@/api/warehouse/warehouse.js' |
|||
import ButtonBar from '@/components/ButtonBar' |
|||
import Pagination from '@/components/pagination' |
|||
import pageye from '@/components/pagination/pageye' |
|||
import divAdd from './warehouseZoneAdd.vue' |
|||
// import divInfo from './warehouseInfo.vue' |
|||
export default { |
|||
components: { |
|||
ButtonBar, |
|||
Pagination, |
|||
pageye, |
|||
divAdd, |
|||
// divInfo |
|||
}, |
|||
data() { |
|||
return { |
|||
btndisabled: false, |
|||
viewState: 1, // 1、列表 2、添加 3、修改 4、查看 |
|||
isSearchShow: false, |
|||
searchxianshitit: '显示查询条件', |
|||
tableLoading: false, |
|||
dataList: [], |
|||
btnList: [{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'toAdd', |
|||
btnLabel: '新增' |
|||
}, |
|||
{ |
|||
type: 'primary', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'toEdit', |
|||
btnLabel: '编辑' |
|||
}, |
|||
{ |
|||
type: 'danger', |
|||
size: 'small', |
|||
icon: 'plus', |
|||
btnKey: 'doDel', |
|||
btnLabel: '删除' |
|||
}, |
|||
{ |
|||
type: 'info', |
|||
size: 'small', |
|||
icon: 'cross', |
|||
btnKey: 'doClose', |
|||
btnLabel: '关闭' |
|||
} |
|||
], |
|||
queryParams: { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
name: '', |
|||
code: "", |
|||
address: "" |
|||
} |
|||
}, |
|||
sids: [], |
|||
selectionList: [], |
|||
warehouseList: [], |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$refs['btnbar'].setButtonList(this.btnList) |
|||
}, |
|||
created() { |
|||
this.loadList() |
|||
this.getwarehouse() |
|||
}, |
|||
methods: { |
|||
selectionLineChangeHandle(val) { |
|||
console.log("val", val); |
|||
|
|||
this.selectionList = val |
|||
|
|||
const aa = [] |
|||
val.forEach(element => { |
|||
aa.push(element.sid) |
|||
}) |
|||
this.sids = aa |
|||
|
|||
|
|||
}, |
|||
getwarehouse() { |
|||
var parpams = { |
|||
orgPath: window.sessionStorage.getItem('defaultOrgPath'), |
|||
} |
|||
req2.getAllWarehouse(parpams).then(resp => { |
|||
console.log('>>>>>>>>>getAllWarehouse', resp) |
|||
this.warehouseList = resp.data |
|||
}).catch(() => {}) |
|||
}, |
|||
// 搜索条件效果 |
|||
clicksearchShow() { |
|||
this.isSearchShow = !this.isSearchShow |
|||
if (this.isSearchShow) { |
|||
this.searchxianshitit = '隐藏查询条件' |
|||
} else { |
|||
this.searchxianshitit = '显示查询条件' |
|||
} |
|||
}, |
|||
btnHandle(btnKey) { |
|||
switch (btnKey) { |
|||
case 'toAdd': |
|||
this.toAdd() |
|||
break |
|||
case 'toEdit': |
|||
this.toEdit() |
|||
break |
|||
case 'doDel': |
|||
this.doDel() |
|||
break |
|||
case 'doClose': |
|||
this.doClose() |
|||
break |
|||
default: |
|||
break |
|||
} |
|||
}, |
|||
loadList() { |
|||
this.tableLoading = true |
|||
this.queryParams.params.userSid = window.sessionStorage.getItem('userSid') |
|||
this.queryParams.params.orgPath = window.sessionStorage.getItem('defaultOrgPath') |
|||
this.queryParams.params.menuUrl = this.$route.path |
|||
req.listPage(this.queryParams).then((resp) => { |
|||
this.tableLoading = false |
|||
if (resp.success) { |
|||
const data = resp.data |
|||
this.queryParams.total = data.total |
|||
this.dataList = data.records |
|||
} else { |
|||
// 根据resp.code进行异常情况处理 |
|||
this.dataList = [] |
|||
this.queryParams.total = 0 |
|||
} |
|||
}).catch(() => { |
|||
this.tableLoading = false |
|||
}) |
|||
}, |
|||
|
|||
// 序号 |
|||
indexMethod(index) { |
|||
var pagestart = (this.queryParams.current - 1) * this.queryParams.size |
|||
var pageindex = index + 1 + pagestart |
|||
return pageindex |
|||
}, |
|||
dosearch() { |
|||
this.queryParams.current = 1 |
|||
this.loadList() |
|||
}, |
|||
resetQuery() { |
|||
this.queryParams = { |
|||
current: 1, |
|||
size: 10, |
|||
total: 0, |
|||
params: { |
|||
name: '', |
|||
code: "", |
|||
address: "" |
|||
} |
|||
} |
|||
this.loadList() |
|||
}, |
|||
toAdd() { |
|||
this.viewState = 2 |
|||
this.$refs['divadd'].showAdd() |
|||
}, |
|||
|
|||
toEdit() { |
|||
if (this.selectionList.length != 1) { |
|||
this.$message({ |
|||
type: 'warning', |
|||
message: "请选择一条数据。", |
|||
showClose: true |
|||
}) |
|||
return |
|||
} |
|||
|
|||
this.viewState = 3 |
|||
this.$refs['divadd'].showEdit(this.selectionList[0]) |
|||
}, |
|||
doClose() { |
|||
this.$store.dispatch('tagsView/delView', this.$route) |
|||
this.$router.go(-1) |
|||
}, |
|||
toRelevancy(row) { |
|||
this.viewState = 4 |
|||
this.$refs['divinfo'].showEdit(row) |
|||
}, |
|||
|
|||
doDel() { |
|||
|
|||
if (this.sids.length > 0) { |
|||
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?' |
|||
this.$confirm(tip, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
const loading = this.$loading({ |
|||
lock: true, |
|||
text: 'Loading', |
|||
spinner: 'el-icon-loading', |
|||
background: 'rgba(0, 0, 0, 0.7)' |
|||
}) |
|||
req.deleteBySids(this.sids).then((resp) => { |
|||
loading.close() |
|||
if (resp.success) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: resp.msg, |
|||
showClose: true |
|||
}) |
|||
this.loadList() |
|||
} else { |
|||
// 根据resp.code进行异常情况处理 |
|||
} |
|||
}).catch(e => { |
|||
loading.close() |
|||
}) |
|||
}).catch(() => {}) |
|||
} else { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: '请至少选择一条记录进行删除操作' |
|||
}) |
|||
} |
|||
}, |
|||
|
|||
resetState() { |
|||
this.viewState = 1 |
|||
}, |
|||
enableChange(sid, state) { |
|||
console.log('sid', sid) |
|||
console.log('state', state) |
|||
req.updateIsEnable(sid, state).then((resp) => { |
|||
if (resp.success) { |
|||
this.$message({ |
|||
type: 'success', |
|||
message: '状态已更新', |
|||
showClose: true |
|||
}) |
|||
} else { // 根据resp.code进行异常情况处理 |
|||
} |
|||
}).catch(e => { |
|||
console.log(e) |
|||
}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
</style> |
@ -0,0 +1,246 @@ |
|||
<template> |
|||
<div> |
|||
|
|||
<div class="tab-header webtop"> |
|||
<!-- 标题 --> |
|||
<div>{{title}}仓库区域</div> |
|||
<!-- start 添加修改按钮 --> |
|||
<div> |
|||
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
|||
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|||
</div> |
|||
<!-- end 添加修改按钮 --> |
|||
<!-- end 详情按钮 --> |
|||
</div> |
|||
|
|||
<div class="listconadd"> |
|||
|
|||
|
|||
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02"> |
|||
|
|||
<el-row class="first_row"> |
|||
<el-col :span="8"> |
|||
|
|||
<div class="span-sty"><span class="must">*</span> 选择所属仓库</div> |
|||
<el-form-item prop="warehouseName"> |
|||
<el-select v-model="formobj.warehouseName" placeholder="请选择所属仓库" class="addinputw addinputInfo" |
|||
@change="selectWarehouseChange"> |
|||
<el-option v-for="item in warehouseList" :key="item.sid" :label="item.warehouseName" |
|||
:value="item.sid" /> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="8"> |
|||
<div class="span-sty"><span class="must">*</span> 区域名称</div> |
|||
<el-form-item prop="zoneName"> |
|||
<el-input v-model="formobj.zoneName" placeholder="区域名称" class="addinputw addinputInfo" clearable /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="8"> |
|||
<div class="span-sty">区域编码</div> |
|||
<el-form-item prop="zoneCode"> |
|||
<span class="addinputw addinputInfo">{{formobj.zoneCode}}</span> |
|||
<!-- <el-input v-model="formobj.areaCode" placeholder="由系统自动生成" :readonly="true" class="addinputw addinputInfo" |
|||
clearable oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" /> --> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="8"> |
|||
|
|||
<div class="span-sty">区域面积</div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.volume" placeholder="区域面积" class="addinputw addinputInfo" clearable |
|||
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="8"> |
|||
<div class="span-sty">计量单位</div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.unit" placeholder="计量单位" class="addinputw addinputInfo" clearable /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
<el-col :span="8"> |
|||
<div class="span-sty">备注</div> |
|||
<el-form-item> |
|||
<el-input v-model="formobj.remarks" placeholder="备注" class="addinputw addinputInfo" clearable /> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
|
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import req from '@/api/warehouse/warehouseZone.js' |
|||
import req2 from '@/api/warehouse/warehouse.js' |
|||
export default { |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
title: "【新增】", |
|||
submitdisabled: false, |
|||
formobj: { |
|||
sid: '', |
|||
zoneName: '', |
|||
zoneCode: '由系统自动生成', |
|||
volume: '', |
|||
unit: '', |
|||
remarks: '', |
|||
warehouseName: '', |
|||
warehouseSid: '', |
|||
useOrgSid: window.sessionStorage.getItem('departmentSid'), |
|||
orgPath: window.sessionStorage.getItem('defaultOrgPath'), |
|||
createOrgSid: window.sessionStorage.getItem('orgSid'), |
|||
userSid: window.sessionStorage.getItem('userSid'), |
|||
|
|||
}, |
|||
warehouseList: [], |
|||
rules: { |
|||
warehouseName: [{ |
|||
required: true, |
|||
message: '请选择所属仓库', |
|||
trigger: 'change' |
|||
}], |
|||
|
|||
zoneName: [{ |
|||
required: true, |
|||
message: '区域名称不能为空', |
|||
trigger: 'blur' |
|||
}], |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
this.initData() |
|||
}, |
|||
methods: { |
|||
initData() { |
|||
var parpams = { |
|||
orgPath: window.sessionStorage.getItem('defaultOrgPath'), |
|||
} |
|||
req2.getAllWarehouse(parpams).then(resp => { |
|||
this.warehouseList = resp.data |
|||
}) |
|||
|
|||
}, |
|||
|
|||
saveOrUpdate() { |
|||
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
|||
|
|||
this.$refs['form_obj'].validate((valid) => { |
|||
if (valid) { |
|||
|
|||
req.saveWarehousezone(this.formobj) |
|||
.then(resp => { |
|||
if (resp.success) { |
|||
this.$message({ |
|||
showClose: true, |
|||
type: 'success', |
|||
message: resp.msg |
|||
}) |
|||
this.handleReturn('true') |
|||
} else { |
|||
// 根据resp.code进行异常情况处理 |
|||
} |
|||
}) |
|||
.catch(() => {}) |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
handleReturn(isreload) { |
|||
if (isreload === 'true') this.$emit('reloadlist') |
|||
this.formobj = { |
|||
sid: '', |
|||
zoneName: '', |
|||
zoneCode: '由系统自动生成', |
|||
volume: '', |
|||
unit: '', |
|||
remarks: '', |
|||
warehouseName: '', |
|||
warehouseSid: '', |
|||
useOrgSid: window.sessionStorage.getItem('departmentSid'), |
|||
orgPath: window.sessionStorage.getItem('defaultOrgPath'), |
|||
createOrgSid: window.sessionStorage.getItem('orgSid'), |
|||
userSid: window.sessionStorage.getItem('userSid'), |
|||
|
|||
} |
|||
this.$emit('doback') |
|||
}, |
|||
showAdd() { |
|||
this.title = "【新增】" |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
|
|||
}, |
|||
showEdit(row) { |
|||
this.title = "【编辑】", |
|||
this.$nextTick(() => { |
|||
this.$refs['form_obj'].clearValidate() |
|||
}) |
|||
|
|||
req.initWarehousezone(row.sid) |
|||
.then(resp => { |
|||
if (resp.success) { |
|||
this.formobj = resp.data |
|||
} |
|||
}) |
|||
.catch(e => { |
|||
this.formobj = row |
|||
}) |
|||
}, |
|||
selectWarehouseChange(val) { |
|||
const choose = this.warehouseList.filter((item) => item.sid == val) |
|||
console.log('>>>>>>>>>selectWarehouseChange', choose) |
|||
this.formobj.warehouseSid = choose[0].sid |
|||
this.formobj.warehouseName = choose[0].warehouseName |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
/deep/ .el-form-item__error { |
|||
margin-left: 120px !important; |
|||
} |
|||
|
|||
.must { |
|||
color: #f00; |
|||
} |
|||
|
|||
.span-sty { |
|||
width: 130px !important; |
|||
align-items: center; |
|||
} |
|||
|
|||
.addinputInfo { |
|||
margin-left: 120px !important; |
|||
} |
|||
|
|||
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw { |
|||
margin-left: 120px !important; |
|||
width: calc(100% - 115px); |
|||
} |
|||
|
|||
.first_row { |
|||
border-top: 1px solid #E0E3EB; |
|||
} |
|||
|
|||
.titleOne { |
|||
padding: 7px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
</style> |
Loading…
Reference in new issue