<template>
|
<a-modal
|
:title="title"
|
:width="650"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
:okButtonProps="{ props: {disabled: disableSubmit} }"
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭"
|
>
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-item
|
:labelCol="{span:4}"
|
:wrapperCol="{span:18}"
|
label="库位编号"
|
>
|
<a-input
|
style="width: 100%"
|
:disabled="disableSubmit"
|
placeholder="请输入库位编号"
|
v-decorator="['num', validatorRules.num ]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-item
|
:labelCol="{span:4}"
|
:wrapperCol="{span:18}"
|
label="行号"
|
>
|
<a-input-number
|
style="width: 100%"
|
:disabled="disableSubmit"
|
placeholder="请输入行号"
|
v-decorator="['xnum', validatorRules.xnum ]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-item
|
:labelCol="{span:4}"
|
:wrapperCol="{span:18}"
|
label="列号"
|
>
|
<a-input-number
|
style="width: 100%"
|
:disabled="disableSubmit"
|
placeholder="请输入列号"
|
v-decorator="['ynum', validatorRules.ynum ]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-item
|
:labelCol="{span:4}"
|
:wrapperCol="{span:18}"
|
label="层号"
|
>
|
<a-input-number
|
style="width: 100%"
|
:disabled="disableSubmit"
|
placeholder="请输入层号"
|
v-decorator="['znum', validatorRules.znum ]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
|
</a-form>
|
</a-spin>
|
|
</a-modal>
|
</template>
|
|
<script>
|
|
import { postAction, getAction, requestPut } from '@/api/manage'
|
import JDate from '@/components/jeecg/JDate'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import JEllipsis from '@/components/jeecg/JEllipsis'//引入过长裁剪
|
import store from '@/store'
|
import pick from 'lodash.pick'
|
|
export default {
|
name: "WarehouseLocationModal",
|
mixins: [JeecgListMixin],
|
components: {
|
JDate,
|
Tooltip,
|
JEllipsis,
|
},
|
data() {
|
return {
|
title: "仓库库位",
|
visible: false,
|
model: {},
|
dataSource: [],
|
disableSubmit: false,
|
warehouseId: "",
|
warehouseAreaId: "",
|
validatorRules: {
|
num: {
|
rules: [
|
{ required: true, message: '请输入库位编号!' },
|
]
|
},
|
xnum: {
|
rules: [
|
{ required: true, message: '请输入行号!' },
|
]
|
},
|
ynum: {
|
rules: [
|
{ required: true, message: '请输入列号!' },
|
]
|
},
|
znum: {
|
rules: [
|
{ required: true, message: '请输入层号!' },
|
]
|
},
|
},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 18 },
|
},
|
confirmLoading: false,
|
form: this.$form.createForm(this),
|
url: {
|
add: '/base/warehouseLocation/add',
|
edit: '/base/warehouseLocation/edit',
|
},
|
}
|
},
|
|
|
methods: {
|
|
add() {
|
this.edit({});
|
},
|
|
edit(record) {
|
this.form.resetFields();
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
this.disableSubmit = false;
|
this.$nextTick(() => {
|
this.form.setFieldsValue(pick(this.model,
|
'num',
|
'xnum',
|
'ynum',
|
'znum',
|
'remark'));
|
});
|
},
|
|
close() {
|
this.$emit('close');
|
this.visible = false;
|
},
|
handleOk() {
|
const that = this;
|
// 触发表单验证
|
this.form.validateFields((err, values) => {
|
if (!err) {
|
that.confirmLoading = true;
|
let formData = Object.assign(this.model, values);
|
let obj;
|
if (!this.model.id) {
|
formData.warehouseId = this.warehouseId
|
formData.warehouseAreaId = this.warehouseAreaId
|
obj = postAction(this.url.add, formData);
|
} else {
|
obj = requestPut(this.url.edit, formData, { id: this.model.id });
|
}
|
obj.then((res) => {
|
if (res.success) {
|
that.$message.success(res.message);
|
that.$emit('ok');
|
that.alterFlag = new Date();
|
} else {
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
that.close();
|
})
|
}
|
})
|
},
|
handleCancel() {
|
this.close()
|
},
|
|
|
},
|
}
|
</script>
|
<style scoped>
|
.ant-btn {
|
padding: 0 10px;
|
margin-left: 3px;
|
}
|
|
.ant-form-item-control {
|
line-height: 0px;
|
}
|
|
.fontweight {
|
font-weight: bold;
|
}
|
|
/** 主表单行间距 */
|
.ant-form .ant-form-item {
|
margin-bottom: 10px;
|
}
|
|
/** Tab页面行间距 */
|
.ant-tabs-content .ant-form-item {
|
margin-bottom: 0px;
|
}
|
.ant-table-tbody .ant-table-row td {
|
padding-top: 10px;
|
padding-bottom: 10px;
|
}
|
|
.anty-row-operator button {
|
margin: 0 5px;
|
}
|
|
.ant-btn-danger {
|
background-color: #ffffff;
|
}
|
|
.ant-modal-cust-warp {
|
height: 100%;
|
}
|
|
.ant-modal-cust-warp .ant-modal-body {
|
height: calc(100% - 110px) !important;
|
overflow-y: auto;
|
}
|
|
.ant-modal-cust-warp .ant-modal-content {
|
height: 90% !important;
|
overflow-y: hidden;
|
}
|
|
/deep/ .notshow {
|
display: none;
|
}
|
|
.frozenRowClass {
|
color: #c9c9c9;
|
}
|
.hight {
|
color: #f5222d;
|
}
|
.middle {
|
color: #fa8c16;
|
}
|
.low {
|
color: #52c41a;
|
}
|
.dataUnKnow {
|
color: #1890ff;
|
}
|
|
/deep/ .frozenRowClass {
|
color: #c9c9c9;
|
}
|
</style>
|