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,51 +2,53 @@
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2022-01-14 16:29:02
* @LastEditTime: 2022-01-17 14:03:24
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
:show-add="false"
@getDataList="getList"
@add="addNew"
/>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
>
<method-btn
slot="handleBtn"
:width="trueWidth"
:method-list="tableBtn"
@clickBtn="handleClick"
<el-form ref="listQuery" :model="listQuery" :inline="true" label-width="120px" @keyup.enter.native="getList()">
<el-form-item :label="$t('module.basicData.Warehouse.StorageBoxNumber')" prop="code">
<el-select
v-model="listQuery.code"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.StorageBoxNumber')])"
clearable
filterable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in storageBoxList"
:key="index"
:label="item.code"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
</el-form-item>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<Factory-add v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getList" />
</div>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</el-form></div>
</template>
<script>
import { StorageBoxInfoList } from '@/api/basicData/Warehouse/StorageBoxInfo'
import FactoryAdd from './components/StorageBoxInfoDetail.vue'
import HeadForm from '@/components/basicData/HeadForm'
import { StorageBoxInfoList, StorageBoxRackCode } from '@/api/basicData/Warehouse/StorageBoxInfo'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import warehouse from '@/filters/basicData/warehouse'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
@@ -64,39 +66,34 @@ import i18n from '@/lang'
*
*/
const tableBtn = [
{
type: 'see',
btnName: 'btn.see'
}
]
const tableProps = [
{
prop: 'code',
label: i18n.t('module.basicData.Warehouse.StorageBoxNumber'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'status',
label: i18n.t('module.basicData.Warehouse.BoxStatus'),
filter: warehouse('enableState'),
align: 'center'
},
{
prop: 'locationName',
prop: 'currLocation',
label: i18n.t('module.basicData.Warehouse.CurrentLocation'),
align: 'center'
},
{
prop: 'isEmpty',
label: i18n.t('module.basicData.Warehouse.IsEmpty'),
filter: warehouse('yesOrNo'),
align: 'center'
}
]
export default {
name: 'StorageBoxInfo',
components: { Pagination, BaseTable, MethodBtn, HeadForm, FactoryAdd },
components: { Pagination, BaseTable },
filters: {
statusFilter(status) {
const statusMap = {
@@ -111,31 +108,32 @@ export default {
return {
keyName: i18n.t('module.basicData.Warehouse.StorageBoxNumber'),
placeholderName: this.$t('module.basicData.Warehouse.StorageBoxNumber'),
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
storageBoxList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: '',
code: ''
}
}
},
created() {
this.getList()
const listQuery1 = {
current: 1,
size: 100
}
StorageBoxRackCode(listQuery1).then(res => {
this.storageBoxList = res.data.records
})
},
methods: {
handleClick(raw) {
this.addNew(raw.data.id)
},
getList(key) {
getList() {
this.listLoading = true
this.listQuery.code = key
StorageBoxInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
@@ -145,13 +143,6 @@ export default {
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
}
}
}

View File

@@ -2,17 +2,49 @@
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2022-01-14 16:34:33
* @LastEditTime: 2022-01-17 14:06:53
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@getDataList="getList"
@add="addNew"
/>
<el-form ref="listQuery" :model="listQuery" :inline="true" label-width="120px" @keyup.enter.native="getList()">
<el-form-item :label="$t('module.basicData.Warehouse.LocationName')" prop="currLocationId">
<el-select
v-model="listQuery.currLocationId"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.LocationName')])"
clearable
filterable
:style="{width: '100%'}"
>
<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.Warehouse.StorageBoxNumber')" prop="storageBoxId">
<el-select
v-model="listQuery.storageBoxId"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.Warehouse.StorageBoxNumber')])"
clearable
filterable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in storageBoxList"
:key="index"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getList()">{{ 'btn.search' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</el-form-item>
</el-form>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
@@ -39,13 +71,13 @@
</template>
<script>
import { StorageBoxInfoList } from '@/api/basicData/Warehouse/StorageBoxInfo'
import FactoryAdd from './components/StorageBoxInfoDetail.vue'
import HeadForm from '@/components/basicData/HeadForm'
import { StorageBoxRackList, StorageBoxRackDelete, StorageBoxRackCode, locationList } from '@/api/basicData/Warehouse/StorageBoxInfo'
import FactoryAdd from './components/StorageBoxRack-add.vue'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
import warehouse from '@/filters/basicData/warehouse'
import i18n from '@/lang'
/**
* 表格表头配置项 TypeScript接口注释
@@ -65,8 +97,12 @@ import i18n from '@/lang'
const tableBtn = [
{
type: 'see',
btnName: 'btn.see'
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
@@ -79,34 +115,35 @@ const tableProps = [
{
prop: 'code',
label: i18n.t('module.basicData.Warehouse.StorageBoxNumber'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'status',
label: i18n.t('module.basicData.Warehouse.BoxStatus'),
filter: warehouse('enableState'),
align: 'center'
},
{
prop: 'locationName',
prop: 'currLocation',
label: i18n.t('module.basicData.Warehouse.LocationName'),
align: 'center'
},
{
prop: 'locationCode',
prop: 'currLocationName',
label: i18n.t('module.basicData.Warehouse.LocationCode'),
align: 'center'
},
{
prop: 'isEmpty',
label: i18n.t('module.basicData.Warehouse.IsEmptyBox'),
filter: warehouse('yesOrNo'),
align: 'center'
}
]
export default {
name: 'StorageBoxInfo',
components: { Pagination, BaseTable, MethodBtn, HeadForm, FactoryAdd },
components: { Pagination, BaseTable, MethodBtn, FactoryAdd },
filters: {
statusFilter(status) {
const statusMap = {
@@ -127,26 +164,57 @@ export default {
tableProps,
list: [],
total: 0,
LocationList: [],
storageBoxList: [],
listLoading: true,
listQuery: {
current: 1,
size: 10,
name: '',
code: ''
storageBoxId: '',
currLocationId: ''
}
}
},
created() {
this.getList()
const listQuery1 = {
current: 1,
size: 100
}
locationList(listQuery1).then(response => {
this.LocationList = response.data
})
StorageBoxRackCode(listQuery1).then(res => {
this.storageBoxList = res.data.records
})
},
methods: {
handleClick(raw) {
this.addNew(raw.data.id)
console.log(raw)
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.code}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
StorageBoxRackDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else {
this.addNew(raw.data.id)
}
},
getList(key) {
getList() {
this.listLoading = true
this.listQuery.code = key
StorageBoxInfoList(this.listQuery).then(response => {
StorageBoxRackList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {

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',