This commit is contained in:
2021-09-13 14:56:28 +08:00
commit ac0d6e9083
777 changed files with 90286 additions and 0 deletions

View File

@@ -0,0 +1,219 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:13:05
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@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"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<cacheArea-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { areaList, areaDelete } from '@/api/basicData/Cache/area'
import { cacheList } from '@/api/basicData/Cache/cache'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import shelfBtn from './components/shelfBtn.vue'
import cacheAreaAdd from './components/cacheArea-add.vue'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.AreaCode'),
align: 'center'
},
{
prop: 'cacheName',
label: i18n.t('module.basicData.cache.CacheName'),
align: 'center'
},
{
prop: 'areaNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'shelf',
label: i18n.t('module.basicData.cache.Shelf'),
subcomponent: shelfBtn,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, cacheAreaAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.AreaName'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
cacheList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
const params = {
current: 1,
size: 500
}
cacheList(params).then(response => {
if (response.data.records) {
this.cacheList = response.data.records
this.getList()
}
})
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
areaDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
const name = this.cacheList.find(citem => { if (citem.id === item.cacheId) return citem })
if (name) {
item.cacheName = name.name
}
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,195 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:09:59
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@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"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
</div>
</template>
<script>import i18n from '@/lang'
import { cacheList, cacheDelete } from '@/api/basicData/Cache/cache'
import HeadForm from '@/components/basicData/HeadForm'
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'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
},
{
type: 'detail',
btnName: 'btn.detail'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.CacheName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.CacheCode'),
align: 'center'
},
{
prop: 'enName',
label: i18n.t('module.basicData.visual.EnglishName'),
align: 'center'
}
]
export default {
name: 'Cache',
components: { Pagination, BaseTable, MethodBtn, HeadForm },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.CacheName') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.cache.CacheCode'),
tableBtn,
trueWidth: 240,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
cacheDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
cacheList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id, isdetail) {
this.$router.push({
name: 'cacheAdd',
query: {
id: id,
isdetail: isdetail
}
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,36 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:18:59
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.storageBox.PositionDetail') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'PositionDetailInfo',
query: {
id: this.injectData.id,
name: this.injectData.name,
code: this.injectData.code,
quantity: this.injectData.quantity
}
})
}
}
}
</script>

View File

@@ -0,0 +1,84 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:39:23
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="140px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.storageBox.PositionCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.PositionCodeAlias')" prop="aliasName">
<el-input v-model="dataForm.aliasName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionCodeAlias')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.PositionNo')" prop="serial">
<el-input v-model="dataForm.serial" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.PositionNo')])" clearable />
</el-form-item>
</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 { PositionDetailInfoAdd } from '@/api/basicData/Cache/storageBox'
export default {
data() {
return {
visible: false,
dataForm: {
storageTankId: 0,
code: '',
aliasName: '',
serial: ''
},
dataRule: {
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.PositionCode')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id, code) {
this.dataForm.storageTankId = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.dataForm.code = code
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
PositionDetailInfoAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
})
}
}
}
</script>

View File

@@ -0,0 +1,110 @@
<!--
* @Author: zwq
* @Date: 2021-07-21 14:05:30
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:41:24
* @Description:
-->
<template>
<div style="margin:50px">
<span>{{ $t('module.basicData.storageBox.code') }}:{{ injectData.code }}</span>
<span>{{ $t('module.basicData.storageBox.name') }}:{{ injectData.name }}</span>
<span>{{ $t('module.basicData.storageBox.StorageQuantity') }}:{{ injectData.quantity }}</span>
<span>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
</span>
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
:is-loading="listLoading"
/>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<PositionDetailInfo-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>
import i18n from '@/lang'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import PositionDetailInfoAdd from './PositionDetailInfo-add'
import { PositionDetailInfoList } from '@/api/basicData/Cache/storageBox'
const tableProps = [
{
prop: 'serial',
label: i18n.t('module.basicData.storageBox.PositionNo'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.storageBox.PositionCode'),
align: 'center'
},
{
prop: 'aliasName',
label: i18n.t('module.basicData.storageBox.PositionCodeAlias'),
align: 'center'
}
]
export default {
components: { Pagination, BaseTable, PositionDetailInfoAdd },
data() {
return {
injectData: {},
addOrUpdateVisible: false,
tableProps,
list: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.injectData = this.$route.query
this.getList()
},
methods: {
getList() {
this.listLoading = true
PositionDetailInfoList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew() {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(this.injectData.id, this.injectData.code)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
span{
margin-left: 30px;
}
</style>

View File

@@ -0,0 +1,383 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-04-28 10:07:44
* @enName:
-->
<template>
<div style="margin:20px">
<el-row :gutter="15">
<el-form
ref="dataForm"
:model="dataForm"
:rules="rules"
size="medium"
label-width="140px"
>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.CacheName')" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.CacheName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.CacheCode')" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" :label="$t('module.basicData.cache.CacheCode')" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.EnglishName')" prop="enName">
<el-input v-model="dataForm.enName" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.EnglishName')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Abbreviation')" prop="abbr">
<el-input v-model="dataForm.abbr" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Abbreviation')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Manufacturer')" prop="manufacturer">
<el-input
v-model="dataForm.manufacturer"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Manufacturer')])"
clearable
:style="{width: '100%'}"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Specs')" prop="description">
<el-input v-model="dataForm.description" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Specs')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.productionTime')" prop="productionTime">
<el-date-picker
v-model="dataForm.productionTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.productionTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.enterTime')" prop="enterTime">
<el-date-picker
v-model="dataForm.enterTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.enterTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.debugTime')" prop="debugTime">
<el-date-picker
v-model="dataForm.debugTime"
:disabled="isdetail"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:style="{width: '100%'}"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.debugTime')])"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.CurrentState')" prop="currentStatus">
<el-select
v-model="dataForm.currentStatus"
:disabled="isdetail"
:placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.CurrentState')])"
clearable
:style="{width: '100%'}"
>
<el-option
v-for="(item, index) in currentStatusOptions"
:key="index"
:label="item.label"
:value="item.value"
:disabled="item.disabled"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.StockNumber')" prop="stockNumber">
<el-input-number v-model="dataForm.stockNumber" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StockNumber')])" :step="1" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.cache.AreaNumber')" prop="areaNumber">
<el-input-number v-model="dataForm.areaNumber" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaNumber')])" :step="1" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable :style="{width: '100%'}" />
</el-form-item>
</el-col>
</el-form>
</el-row>
<div style="margin:20px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<span v-if="!isdetail">
<el-button type="primary" @click="dataFormSubmit()">{{ 'btn.save' | i18nFilter }}</el-button>
<el-button v-if="listQuery.cacheId" type="primary" @click="addNew()">{{ $t('module.basicData.cache.addCacheArea') }}</el-button>
</span>
</div>
<div style="height:380px;overflow:auto">
<base-table
:page="listQuery.current"
:limit="listQuery.size"
:table-config="tableProps"
:table-data="list"
>
<method-btn
v-if="!isdetail"
slot="handleBtn"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
</div>
<cacheArea-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { cacheDetail, cacheUpdate, cacheAdd, cacheCode } from '@/api/basicData/Cache/cache'
import { areaList, areaDelete } from '@/api/basicData/Cache/area'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import cacheAreaAdd from './cacheArea-add.vue'
import shelfBtn from './shelfBtn.vue'
import { timeFormatter } from '@/filters'
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.AreaCode'),
align: 'center'
},
{
prop: 'areaNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'shelf',
label: i18n.t('module.basicData.cache.Shelf'),
subcomponent: shelfBtn,
align: 'center'
}
]
export default {
components: { BaseTable, MethodBtn, cacheAreaAdd },
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
dataForm: {
name: '',
code: '',
enName: '',
abbr: '',
manufacturer: '',
description: '',
productionTime: '',
enterTime: '',
debugTime: '',
currentStatus: '',
stockNumber: '',
areaNumber: '',
remark: ''
},
listQuery: {
current: 1,
size: 990,
cacheId: ''
},
rules: {
name: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheName')]),
trigger: 'blur'
}],
code: [{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheCode')]),
trigger: 'blur'
}]
},
currentStatusOptions: [{
'label': '正常',
'value': '0'
}, {
'label': '暂停',
'value': '1'
}, {
'label': '维修',
'value': '2'
}],
cacheId: '',
isdetail: false
}
},
created() {
this.cacheId = this.$route.query.id
this.init()
},
methods: {
init() {
this.isdetail = false
this.isdetail = Boolean(this.$route.query.isdetail)
this.listQuery.cacheId = ''
this.list.splice(0, this.list.length)
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.cacheId) {
cacheDetail(this.cacheId).then(res => {
this.dataForm = res.data
})
this.listQuery.cacheId = this.cacheId
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
})
} else {
cacheCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
getList() {
areaList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
}
})
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
areaDelete(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)
}
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = {
'abbr': this.dataForm.abbr,
'code': this.dataForm.code,
'currentStatus': this.dataForm.currentStatus,
'debugTime': this.dataForm.debugTime,
'enName': this.dataForm.enName,
'enterTime': this.dataForm.enterTime,
'manufacturer': this.dataForm.manufacturer,
'name': this.dataForm.name,
'productionTime': this.dataForm.productionTime,
'remark': this.dataForm.remark,
'description': this.dataForm.description,
'stockNumber': this.dataForm.stockNumber,
'areaNumber': this.dataForm.areaNumber,
'id': this.cacheId
}
if (this.cacheId) {
cacheUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
})
} else {
cacheAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500
})
this.listQuery.cacheId = res.data.id
})
}
}
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.drawer-footer {
width: 100%;
margin-top: 50px;
border-top: 1px solid #e8e8e8;
border-bottom: 1px solid #e8e8e8;
padding: 10px 50px;
text-align: left;
background: #fff;
}
</style>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:00:18
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.cacheId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.AreaName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.AreaCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaCode')])" clearable />
</el-form-item>
<el-form-item v-if="isPage" :label="$t('module.basicData.cache.CacheName')" prop="cacheId">
<el-select v-model="dataForm.cacheId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.CacheName')])" clearable>
<el-option
v-for="item in cacheArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.StorageQuantity')" prop="areaNumber">
<el-input-number v-model="dataForm.areaNumber" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StorageQuantity')])" :step="1" />
</el-form-item>
</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 { areaDetail, areaUpdate, areaAdd, areaCode } from '@/api/basicData/Cache/area'
import { cacheList } from '@/api/basicData/Cache/cache'
export default {
props: {
cacheId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
isPage: false,
dataForm: {
id: 0,
cacheId: '',
name: '',
code: '',
areaNumber: ''
},
cacheArr: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaCode')]), trigger: 'blur' }
],
cacheId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.CacheName')]), trigger: 'change' }
]
}
}
},
methods: {
init(id, isPage) {
this.isPage = isPage || false
this.dataForm.id = id || ''
if (!this.isPage) {
this.dataForm.cacheId = this.cacheId
}
this.cacheArr.splice(0, this.cacheArr.length)
const params = {
current: 1,
size: 500
}
cacheList(params).then(response => {
if (response.data.records) {
this.cacheArr = response.data.records
}
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
areaDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
areaCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
areaUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
areaAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,188 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 16:44:10
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<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"
/>
</base-table>
<locationAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :shelf-id="listQuery.shelfId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { locationList, locationDelete } from '@/api/basicData/Cache/location'
import locationAttrAdd from './locationAttr-add.vue'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.LocationCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.LocationName'),
align: 'center'
},
{
prop: 'anotherName',
label: i18n.t('module.basicData.cache.anotherName'),
align: 'center'
},
{
prop: 'place',
label: i18n.t('module.basicData.cache.place'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.visual.Remarks'),
align: 'center'
}
]
export default {
name: 'Location',
components: { BaseTable, MethodBtn, locationAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: true,
listQuery: {
current: 1,
size: 990,
shelfId: ''
}
}
},
created() {
this.listQuery.shelfId = this.$route.query.id
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
locationDelete(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) {
this.listLoading = true
this.listQuery.name = key
locationList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
// 新增 / 修改
addNew(shelfId) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(shelfId)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,130 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:23:03
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.shelfId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.LocationName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.LocationName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.LocationCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.LocationCode')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.anotherName')" prop="anotherName">
<el-input v-model="dataForm.anotherName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.anotherName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.place')" prop="place">
<el-input v-model="dataForm.place" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.place')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</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 { locationDetail, locationUpdate, locationAdd, locationCode } from '@/api/basicData/Cache/location'
export default {
props: {
shelfId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
anotherName: '',
place: '',
remark: ''
},
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.LocationName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.LocationCode')]), trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
locationDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
locationCode().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,
'anotherName': this.dataForm.anotherName,
'place': this.dataForm.place,
'remark': this.dataForm.remark,
'shelfId': this.shelfId,
'id': this.dataForm.id
}
if (this.dataForm.id) {
locationUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
locationAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,33 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 13:12:47
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.cache.ManageLocation') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'locationAdd',
query: {
id: this.injectData.id
}
})
}
}
}
</script>

View File

@@ -0,0 +1,185 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-11 09:22:52
* @Description:
-->
<template>
<div class="app-container">
<div style="margin:10px 50px">
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
</div>
<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"
/>
</base-table>
<shelfAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :area-id="listQuery.areaId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import { shelfList, shelfDelete } from '@/api/basicData/Cache/shelf'
import shelfAttrAdd from './shelfAttr-add.vue'
import locationBtn from './locationBtn.vue'
import BaseTable from '@/components/BaseTable'
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.ShelfCode'),
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.ShelfName'),
align: 'center'
},
{
prop: 'shelfNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: locationBtn,
align: 'center'
}
]
export default {
name: 'Shelf',
components: { BaseTable, MethodBtn, shelfAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
tableBtn,
trueWidth: 200,
tableProps,
list: [],
listLoading: true,
listQuery: {
current: 1,
size: 990,
areaId: ''
}
}
},
created() {
this.listQuery.areaId = this.$route.query.id
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
shelfDelete(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) {
this.listLoading = true
this.listQuery.name = key
shelfList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
},
goback() {
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,145 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: gtz
* @LastEditTime: 2021-04-16 15:01:45
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.areaId ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.cache.ShelfName')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.ShelfName')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.ShelfCode')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.ShelfCode')])" clearable />
</el-form-item>
<el-form-item v-if="isPage" :label="$t('module.basicData.cache.AreaName')" prop="areaId">
<el-select v-model="dataForm.areaId" filterable :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.AreaName')])" clearable>
<el-option
v-for="item in areaArr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.cache.StorageQuantity')" prop="shelfNumber">
<el-input-number v-model="dataForm.shelfNumber" :step="1" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.cache.StorageQuantity')])" clearable />
</el-form-item>
</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 { shelfDetail, shelfUpdate, shelfAdd, shelfCode } from '@/api/basicData/Cache/shelf'
import { areaList } from '@/api/basicData/Cache/area'
export default {
props: {
areaId: {
type: String,
default: () => {
return ''
}
}
},
data() {
return {
visible: false,
isPage: false,
dataForm: {
id: 0,
areaId: '',
name: '',
code: '',
shelfNumber: ''
},
areaArr: [],
dataRule: {
name: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.ShelfName')]), trigger: 'blur' }
],
code: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.ShelfCode')]), trigger: 'blur' }
],
areaId: [
{ required: true, message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.cache.AreaName')]), trigger: 'change' }
]
}
}
},
methods: {
init(id, isPage) {
this.isPage = isPage || false
this.dataForm.id = id || ''
if (!this.isPage) {
this.dataForm.areaId = this.areaId
}
this.areaArr.splice(0, this.areaArr.length)
const params = {
current: 1,
size: 500
}
areaList(params).then(response => {
if (response.data.records) {
this.areaArr = response.data.records
}
})
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
shelfDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
shelfCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
if (this.dataForm.id) {
shelfUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
shelfAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,33 @@
<!--
* @Date: 2021-01-07 20:09:37
* @LastEditors: zwq
* @LastEditTime: 2021-03-06 13:03:40
* @FilePath: \basic-admin\src\components\BaseTable\subcomponents\CheckDetail.vue
* @Description:
-->
<template>
<span>
<el-button type="text" size="small" @click="emitClick">{{ $t('module.basicData.cache.ManageShelves') }}</el-button>
</span>
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
methods: {
emitClick() {
this.$router.push({
name: 'shelfAdd',
query: {
id: this.injectData.id
}
})
}
}
}
</script>

View File

@@ -0,0 +1,146 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 16:37:56
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 13:59:43
* @Description:
-->
<template>
<el-dialog
:title="!dataForm.id ? 'btn.add' : 'btn.edit' | i18nFilter"
:visible.sync="visible"
>
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="130px" @keyup.enter.native="dataFormSubmit()">
<el-form-item :label="$t('module.basicData.storageBox.name')" prop="name">
<el-input v-model="dataForm.name" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.name')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.code')" prop="code">
<el-input v-model="dataForm.code" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.code')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.StorageQuantity')" prop="quantity">
<el-input-number v-model="dataForm.quantity" :min="0" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.StorageQuantity')])" />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.alias')" prop="aliasName">
<el-input v-model="dataForm.aliasName" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.alias')])" clearable />
</el-form-item>
<el-form-item :label="$t('module.basicData.storageBox.status')" prop="status">
<el-select v-model="dataForm.status" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.storageBox.status')])" clearable>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('module.basicData.visual.Remarks')" prop="remark">
<el-input v-model="dataForm.remark" :placeholder="$i18nForm(['placeholder.input', $t('module.basicData.visual.Remarks')])" clearable />
</el-form-item>
</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 { storageBoxDetail, storageBoxUpdate, storageBoxAdd, storageBoxCode } from '@/api/basicData/Cache/storageBox'
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
name: '',
code: '',
status: 0,
aliasName: '',
quantity: 0,
remark: ''
},
options: [
{
value: 0,
label: '正常'
},
{
value: 1,
label: '维修中'
},
{
value: 2,
label: '报废'
}
],
dataRule: {
name: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.name')]),
trigger: 'blur' }
],
code: [
{
required: true,
message: this.$i18nForm(['placeholder.input', this.$t('module.basicData.storageBox.code')]),
trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
storageBoxDetail(this.dataForm.id).then(res => {
this.dataForm = res.data
})
} else {
storageBoxCode().then(res => {
this.dataForm.code = res.data
})
}
})
},
// 表单提交
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const data = this.dataForm
data.id = this.dataForm.id
if (this.dataForm.id) {
storageBoxUpdate(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
} else {
storageBoxAdd(data).then(res => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
})
}
}
})
}
}
}
</script>

View File

@@ -0,0 +1,219 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-03-25 16:13:19
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@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"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<shelfAttr-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { shelfList, shelfDelete } from '@/api/basicData/Cache/shelf'
import { areaList } from '@/api/basicData/Cache/area'
import shelfAttrAdd from './components/shelfAttr-add.vue'
import locationBtn from './components/locationBtn.vue'
import { timeFormatter } from '@/filters'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.cache.ShelfName'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.cache.ShelfCode'),
align: 'center'
},
{
prop: 'areaName',
label: i18n.t('module.basicData.cache.AreaName'),
align: 'center'
},
{
prop: 'shelfNumber',
label: i18n.t('module.basicData.cache.StorageQuantity'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: locationBtn,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, shelfAttrAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.cache.ShelfName'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
areaList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
const params = {
current: 1,
size: 500
}
areaList(params).then(response => {
if (response.data.records) {
this.areaList = response.data.records
}
this.getList()
})
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
shelfDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
shelfList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
this.list.forEach(item => {
const name = this.areaList.find(aitem => { if (aitem.id === item.areaId) return aitem })
if (name) {
item.areaName = name.name
}
})
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>

View File

@@ -0,0 +1,216 @@
<!--
* @Author: zwq
* @Date: 2020-12-29 15:41:11
* @LastEditors: zwq
* @LastEditTime: 2021-07-21 14:00:56
* @Description:
-->
<template>
<div class="app-container">
<head-form
:placeholder-name="placeholderName"
:key-name="keyName"
@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"
/>
</base-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.current"
:limit.sync="listQuery.size"
@pagination="getList()"
/>
<storageBox-add v-if="addOrUpdateVisible" ref="addOrUpdate" :cache-id="listQuery.cacheId" @refreshDataList="getList" />
</div>
</template>
<script>import i18n from '@/lang'
import HeadForm from '@/components/basicData/HeadForm'
import BaseTable from '@/components/BaseTable'
import PositionDetail from './components/PositionDetail'
import storageBoxAdd from './components/storageBox-add'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
import { storageBoxList, storageBoxDelete } from '@/api/basicData/Cache/storageBox'
import { timeFormatter } from '@/filters'
import basicData from '@/filters/basicData'
/**
* 表格表头配置项 TypeScript接口注释
* tableConfig<ConfigItem> = []
*
* Interface ConfigItem = {
* prop: string,
* label: string,
* width: string,
* align: string,
* subcomponent: function,
* filter: function
* }
*
*
*/
const tableBtn = [
{
type: 'edit',
btnName: 'btn.edit'
},
{
type: 'delete',
btnName: 'btn.delete'
}
]
const tableProps = [
{
prop: 'createTime',
label: i18n.t('module.basicData.factory.createTime'),
filter: timeFormatter,
align: 'center'
},
{
prop: 'name',
label: i18n.t('module.basicData.storageBox.name'),
align: 'center'
},
{
prop: 'code',
label: i18n.t('module.basicData.storageBox.code'),
align: 'center'
},
{
prop: 'aliasName',
label: i18n.t('module.basicData.storageBox.alias'),
align: 'center'
},
{
prop: 'quantity',
label: i18n.t('module.basicData.storageBox.StorageQuantity'),
align: 'center'
},
{
prop: 'status',
label: i18n.t('module.basicData.storageBox.status'),
filter: basicData('storage'),
align: 'center'
},
{
prop: 'remark',
label: i18n.t('module.basicData.storageBox.remark'),
align: 'center'
},
{
prop: 'location',
label: i18n.t('module.basicData.cache.Location'),
subcomponent: PositionDetail,
align: 'center'
}
]
export default {
name: 'Area',
components: { Pagination, BaseTable, MethodBtn, HeadForm, storageBoxAdd },
filters: {
statusFilter(status) {
const statusMap = {
published: 'success',
draft: 'info',
deleted: 'danger'
}
return statusMap[status]
}
},
data() {
return {
addOrUpdateVisible: false,
keyName: i18n.t('module.basicData.visual.keyword'),
placeholderName: this.$t('module.basicData.storageBox.name') + this.$t('module.basicData.visual.Or') + this.$t('module.basicData.storageBox.code'),
tableBtn,
trueWidth: 200,
tableProps,
list: [],
areaList: [],
total: 0,
listLoading: true,
listQuery: {
current: 1,
size: 10
}
}
},
created() {
this.getList()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.name}]?`, this.$t('module.basicData.visual.Tips'), {
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
type: 'warning'
}).then(() => {
storageBoxDelete(raw.data.id).then(response => {
this.$message({
message: this.$t('module.basicData.visual.success'),
type: 'success',
duration: 1500,
onClose: () => {
this.getList()
}
})
})
}).catch(() => {})
} else if (raw.type === 'edit') {
this.addNew(raw.data.id)
} else {
this.addNew(raw.data.id, true)
}
},
getList(key) {
this.listLoading = true
this.listQuery.name = key
this.listQuery.code = key
storageBoxList(this.listQuery).then(response => {
if (response.data.records) {
this.list = response.data.records
} else {
this.list.splice(0, this.list.length)
}
this.total = response.data.total
this.listLoading = false
})
},
// 新增 / 修改
addNew(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true)
})
}
}
}
</script>
<style scoped>
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>