This commit is contained in:
2022-01-17 15:18:33 +08:00
parent 975d14c886
commit d07e209936
14 changed files with 1019 additions and 200 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-12 16:24:32
* @LastEditTime: 2022-01-17 10:19:45
* @Description:
-->
<template>
@@ -10,7 +10,7 @@
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="120px" @keyup.enter.native="dataFormSubmit()">
<el-form ref="dataForm" :model="dataForm" label-width="120px">
<el-form-item :label="$t('module.basicData.factory.FactoryName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryName')])" clearable />
</el-form-item>
@@ -26,13 +26,12 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">{{ 'btn.cancel' | i18nFilter }}</el-button>
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.confirm' | i18nFilter }}</el-button>
</span>
</el-dialog>
</template>
<script>
import { factoryDetail, factoryUpdate, factoryAdd, factoryCode } from '@/api/basicData/FactoryManagement/factory'
import { StorageBoxInfoDetail } from '@/api/basicData/Warehouse/StorageBoxInfo'
export default {
data() {
@@ -44,20 +43,6 @@ export default {
code: '',
address: '',
description: ''
},
dataRule: {
name: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryCode')]),
trigger: 'blur' }
]
}
}
},
@@ -67,57 +52,12 @@ export default {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
factoryDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.address = res.data.address
this.dataForm.description = res.data.description
})
} else {
factoryCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'address': this.dataForm.address,
'description': this.dataForm.description,
'id': this.dataForm.id
}
if (this.dataForm.id) {
factoryUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
factoryAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
StorageBoxInfoDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.address = res.data.address
this.dataForm.description = res.data.description
})
})
}
}

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-12 16:24:32
* @LastEditTime: 2022-01-17 11:21:26
* @Description:
-->
<template>
@@ -11,17 +11,57 @@
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="120px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.factory.FactoryName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryName')])" clearable />
<el-form-item :label="$t('module.basicData.Warehouse.LocationName')" prop="currLocationId">
<el-select
v-model="dataForm.currLocationId"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.LocationName')])"
clearable
filterable
:style="{width: '100%'}"
@change="selectGetLabel1"
>
<el-option
v-for="(item, index) in LocationList"
:key="index"
:label="item.locationName"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.factory.FactoryCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.FactoryCode')])" clearable />
<el-form-item :label="$t('module.basicData.Warehouse.StorageBoxNumber')" prop="storageBoxId">
<el-select
v-model="dataForm.storageBoxId"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.StorageBoxNumber')])"
clearable
filterable
:style="{width: '100%'}"
@change="selectGetLabel2"
>
<el-option
v-for="(item, index) in storageBoxList"
:key="index"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.factory.Address')" prop="address">
<el-input v-model="dataForm.address" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.factory.Address')])" clearable />
<el-form-item :label="$t('module.basicData.Warehouse.BoxStatus')" prop="status">
<el-switch
v-model="dataForm.status"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="description">
<el-input v-model="dataForm.description" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
<el-form-item :label="$t('module.basicData.Warehouse.IsEmptyBox')" prop="isEmpty">
<el-switch
v-model="dataForm.isEmpty"
:active-value="1"
:inactive-value="0"
active-color="#13ce66"
inactive-color="#AAAAAA"
/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -32,7 +72,7 @@
</template>
<script>
import { factoryDetail, factoryUpdate, factoryAdd, factoryCode } from '@/api/basicData/FactoryManagement/factory'
import { StorageBoxRackDetail, StorageBoxRackUpdate, StorageBoxRackAdd, StorageBoxRackCode, locationList } from '@/api/basicData/Warehouse/StorageBoxInfo'
export default {
data() {
@@ -40,22 +80,26 @@ export default {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
address: '',
description: ''
locationName: '',
currLocationId: '',
storageBoxId: '',
status: '',
isEmpty: ''
},
LocationList: [],
storageBoxList: [],
dataRule: {
name: [
currLocationId: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryName')]),
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.Warehouse.LocationName')]),
trigger: 'blur' }
],
code: [
storageBoxId: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.factory.FactoryCode')]),
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.Warehouse.StorageBoxNumber')]),
trigger: 'blur' }
]
}
@@ -65,35 +109,46 @@ export default {
init(id) {
this.dataForm.id = id || ''
this.visible = true
const listQuery = {
current: 1,
size: 100
}
locationList(listQuery).then(response => {
this.LocationList = response.data
})
StorageBoxRackCode(listQuery).then(res => {
this.storageBoxList = res.data.records
})
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
factoryDetail(this.dataForm.id).then(res => {
this.dataForm.name = res.data.name
this.dataForm.code = res.data.code
this.dataForm.address = res.data.address
this.dataForm.description = res.data.description
})
} else {
factoryCode().then(res => {
this.dataForm.code = res.data
StorageBoxRackDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
}
})
},
selectGetLabel1(vId) {
let obj = {}
obj = this.LocationList.find((item) => {
return item.id === vId
})
this.dataForm.locationName = obj.locationName
},
selectGetLabel2(vId) {
let obj = {}
obj = this.storageBoxList.find((item) => {
return item.id === vId
})
this.dataForm.code = obj.code
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'name': this.dataForm.name,
'code': this.dataForm.code,
'address': this.dataForm.address,
'description': this.dataForm.description,
'id': this.dataForm.id
}
const data = this.dataForm
if (this.dataForm.id) {
factoryUpdate(data).then(res => {
StorageBoxRackUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
@@ -105,7 +160,7 @@ export default {
})
})
} else {
factoryAdd(data).then(res => {
StorageBoxRackAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',