You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
294 lines
8.4 KiB
294 lines
8.4 KiB
<template>
|
|
<div>
|
|
|
|
<div class="tab-header webtop">
|
|
<!-- 标题 -->
|
|
<div>库区信息</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-card class="box-card">
|
|
<div class="item">
|
|
<span class="item_text"><span class="must">*</span> 选择所属仓库:</span>
|
|
<el-select v-model="formobj.warehouseName" placeholder="请选择所属仓库" class="item_input"
|
|
@change="selectWarehouseChange">
|
|
<el-option v-for="item in warehouseList" :key="item.sid" :label="item.warehouseName" :value="item.sid" />
|
|
</el-select>
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text"><span class="must">*</span> 库区名称:</span>
|
|
<el-input v-model="formobj.areaName" placeholder="库区名称" class="item_input" clearable />
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text"><span class="must">*</span> 库区编码:</span>
|
|
<el-input v-model="formobj.areaCode" placeholder="库区编码" class="item_input" clearable
|
|
oninput="value=value.replace(/[^A-Za-z0-9]/g, '')" />
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text">库区容量:</span>
|
|
<el-input v-model="formobj.volume" placeholder="库区容量" class="item_input" clearable
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" />
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text">计量单位:</span>
|
|
<el-input v-model="formobj.unit" placeholder="计量单位" class="item_input" clearable />
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text"><span class="must">*</span> 库区类型:</span>
|
|
<el-select v-model="formobj.areaTypeName" placeholder="请选择库区类型" class="item_input"
|
|
@change="selectWarehouseTypeValueChange">
|
|
<el-option v-for="item in warehouseTypeList" :key="item.sid" :label="item.warehouseAreaTypeName"
|
|
:value="item.sid" />
|
|
</el-select>
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text">库区备注:</span>
|
|
<el-input v-model="formobj.remarks" placeholder="库区备注" class="item_input" clearable />
|
|
</div>
|
|
|
|
</el-card>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/baseinfo/warehouseArea/warehouseArea.js'
|
|
import req2 from '@/api/baseinfo/warehouse/warehouse.js'
|
|
import req3 from '@/api/baseinfo/warehouseAreaType/warehouseAreaType.js'
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
submitdisabled: false,
|
|
formobj: {
|
|
sid: '',
|
|
areaName: '',
|
|
areaCode: '',
|
|
volume: '',
|
|
unit: '',
|
|
remarks: '',
|
|
warehouseName: '',
|
|
warehouseSid: '',
|
|
areaTypeSid: "",
|
|
areaTypeName: "",
|
|
orgPath: window.sessionStorage.getItem('orgSidPath'),
|
|
useOrgSid: window.sessionStorage.getItem('defaultDeptSid'),
|
|
userSid: window.sessionStorage.getItem('userSid'),
|
|
createOrgSid: window.sessionStorage.getItem('orgSid'),
|
|
},
|
|
warehouseList: [],
|
|
warehouseTypeList: [],
|
|
}
|
|
},
|
|
created() {
|
|
|
|
},
|
|
methods: {
|
|
initData() {
|
|
var parpams = {
|
|
orgPath: window.sessionStorage.getItem('orgSid'),
|
|
}
|
|
req2.getAllWarehouse(parpams).then(resp => {
|
|
this.warehouseList = resp.data
|
|
})
|
|
|
|
req3.getAllWarehouseareatype(parpams).then(resp => {
|
|
this.warehouseTypeList = resp.data
|
|
})
|
|
|
|
},
|
|
|
|
saveOrUpdate() {
|
|
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
|
|
|
if (this.formobj.warehouseName == '' || this.formobj.warehouseSid == '') {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'warning',
|
|
message: '所属仓库不能为空'
|
|
})
|
|
return
|
|
}
|
|
|
|
if (this.formobj.areaName == '') {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'warning',
|
|
message: '库区名称不能为空'
|
|
})
|
|
return
|
|
}
|
|
|
|
if (this.formobj.areaCode == '') {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'warning',
|
|
message: '库区编码不能为空'
|
|
})
|
|
return
|
|
}
|
|
|
|
if (this.formobj.areaTypeName == '' || this.formobj.areaTypeSid == '') {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'warning',
|
|
message: '库区类型不能为空'
|
|
})
|
|
return
|
|
}
|
|
this.submitdisabled = true
|
|
req.saveWarehousearea(this.formobj)
|
|
.then(resp => {
|
|
if (resp.success) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'success',
|
|
message: resp.msg
|
|
})
|
|
this.handleReturn('true')
|
|
} else {
|
|
// 根据resp.code进行异常情况处理
|
|
this.submitdisabled = false
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
},
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
this.formobj = {
|
|
sid: '',
|
|
areaName: '',
|
|
areaCode: '',
|
|
volume: '',
|
|
unit: '',
|
|
remarks: '',
|
|
warehouseName: '',
|
|
warehouseSid: '',
|
|
areaTypeSid: "",
|
|
areaTypeName: "",
|
|
orgPath: window.sessionStorage.getItem('orgSidPath'),
|
|
useOrgSid: window.sessionStorage.getItem('defaultDeptSid'),
|
|
userSid: window.sessionStorage.getItem('userSid'),
|
|
createOrgSid: window.sessionStorage.getItem('orgSid'),
|
|
|
|
}
|
|
this.submitdisabled = false
|
|
this.$emit('doback')
|
|
},
|
|
showAdd() {
|
|
this.initData()
|
|
},
|
|
showEdit(row) {
|
|
this.initData()
|
|
req.initWarehousearea(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
|
|
},
|
|
selectWarehouseTypeValueChange(val) {
|
|
const choose = this.warehouseTypeList.filter((item) => item.sid == val)
|
|
console.log('>>>>>>>>>selectWarehouseTypeValueChange', choose)
|
|
this.formobj.areaTypeSid = choose[0].sid
|
|
this.formobj.areaTypeName = choose[0].warehouseAreaTypeName
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
// 隐藏上传组件
|
|
|
|
::v-deep .hide {
|
|
.el-upload--picture-card {
|
|
display: none !important;
|
|
}
|
|
}
|
|
|
|
.box-card {
|
|
margin-left: 60px;
|
|
margin-right: 60px;
|
|
min-width: 70%;
|
|
margin-top: 20px;
|
|
|
|
.item {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
margin-top: 15px;
|
|
height: 40px;
|
|
line-height: 40px;
|
|
|
|
.item_text {
|
|
flex: 0.8;
|
|
font-size: 18px;
|
|
text-align: right;
|
|
|
|
.must {
|
|
color: #f00;
|
|
}
|
|
}
|
|
|
|
.item_input {
|
|
flex: 4;
|
|
font-size: 16px;
|
|
margin-left: 10px;
|
|
margin-right: 80px;
|
|
}
|
|
|
|
.item_left_input {
|
|
width: 20%;
|
|
}
|
|
|
|
.item_left_text {
|
|
height: 30px;
|
|
margin-left: 20px;
|
|
line-height: 30px;
|
|
color: #018AD2;
|
|
padding: 0px 15px;
|
|
border: 1.5px solid #018AD2;
|
|
border-radius: 5px;
|
|
|
|
}
|
|
|
|
.item_right {
|
|
flex: 1;
|
|
justify-items: center;
|
|
|
|
.item_right_list_text {
|
|
font-size: 16px;
|
|
}
|
|
|
|
.item_right_list_delect {
|
|
color: #5E94FF;
|
|
margin-left: 20px;
|
|
font-size: 16px;
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
</style>
|
|
|