<template>
|
<div class="invetoryEdit height overflow">
|
<div class="centent-form overflowy-auto">
|
<el-form
|
class="margin-auto width90"
|
ref="registerForm"
|
:model="registerForm"
|
size="mini"
|
:rules="rules"
|
label-position="left"
|
label-width="120px"
|
>
|
<el-form-item label="编号:" prop="place">
|
<el-input disabled v-model="registerForm.pvcCode" clearable></el-input>
|
</el-form-item>
|
<el-form-item label="库位号:" prop="placeType">
|
<el-select v-model="registerForm.place" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item, index) in placeList"
|
:key="'place' + index"
|
:label="item.place"
|
:value="item.place"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="器具号:" prop="placeType">
|
<el-select v-model="registerForm.containerName" filterable clearable placeholder="请选择">
|
<el-option
|
v-for="(item, index) in containerNameList"
|
:key="'containerName' + index"
|
:label="item.containerName"
|
:value="item.containerName"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="palteEdit-button text-right margin-right15 margin-top2">
|
<el-button
|
type="primary"
|
size="mini"
|
class="form-buttom"
|
:loading="savloading"
|
@click="submitForm('registerForm')"
|
>提交</el-button
|
>
|
<el-button type="primary" size="mini" class="form-buttom" @click="$emit('cancel')">取消</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { PlaceAddOrUpdate, PlaceVsContainerGetCode } from '@/api/inventory';
|
import { PlaceSearch } from '@/api/position';
|
import { ContainerSearch } from '@/api/palte';
|
export default {
|
data() {
|
return {
|
registerForm: { pvcCode: '' },
|
placeList: [],
|
containerNameList: [],
|
disabled: false,
|
rules: {
|
deptName: { required: true, message: '请输部门名称', trigger: 'change' },
|
deptDes: { required: true, message: '请输入部门描述', trigger: 'change' },
|
enable: { required: true, message: '请选择是否启用', trigger: 'change' }
|
},
|
savloading: false
|
};
|
},
|
props: {
|
rowitem: {
|
type: Object,
|
default: {}
|
}
|
},
|
mounted() {
|
if (JSON.stringify(this.rowitem) != '{}') {
|
this.registerForm = this.rowitem;
|
} else {
|
this.PlaceVsContainerGetCode();
|
}
|
|
this.PlaceSearch();
|
this.ContainerSearch();
|
},
|
methods: {
|
//编号
|
PlaceVsContainerGetCode() {
|
PlaceVsContainerGetCode().then(res => {
|
this.registerForm.pvcCode = res;
|
});
|
},
|
//库位编号
|
PlaceSearch() {
|
PlaceSearch('1&onePageNum=999').then(res => {
|
if (res.code == 0) {
|
this.placeList = res.data;
|
}
|
});
|
},
|
//器具编号
|
ContainerSearch() {
|
ContainerSearch('1&onePageNum=999').then(res => {
|
if (res.code == 0) {
|
this.containerNameList = res.data;
|
}
|
});
|
},
|
submitForm(registerForm) {
|
this.$refs[registerForm].validate(valid => {
|
if (valid) {
|
this.savloading = true;
|
PlaceAddOrUpdate(this.registerForm).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '提交成功'
|
});
|
this.$emit('addsubmit');
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '提交失败'
|
});
|
}
|
this.savloading = false;
|
});
|
}
|
});
|
}
|
},
|
watch: {}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.invetoryEdit {
|
width: 98%;
|
padding: 1%;
|
.show-pwd {
|
position: absolute;
|
right: 10px;
|
top: 3px;
|
font-size: 16px;
|
color: #889aa4;
|
cursor: pointer;
|
user-select: none;
|
}
|
.centent-form {
|
height: 92%;
|
width: 100%;
|
margin: auto;
|
}
|
.invetoryEdit-button {
|
}
|
::v-deep .el-form-item__content {
|
width: 60%;
|
}
|
::v-deep .el-select {
|
width: 100%;
|
}
|
}
|
</style>
|