2021-09-13 14:56:28 +08:00
|
|
|
|
<!--
|
|
|
|
|
* @Author: zwq
|
|
|
|
|
* @Date: 2020-12-29 15:41:11
|
2022-03-03 20:48:59 +08:00
|
|
|
|
* @LastEditors: fzq
|
2022-03-20 09:50:14 +08:00
|
|
|
|
* @LastEditTime: 2022-03-19 10:25:46
|
2021-09-13 14:56:28 +08:00
|
|
|
|
* @Description:
|
|
|
|
|
-->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="app-container">
|
2022-03-05 19:43:42 +08:00
|
|
|
|
<!-- <div style="margin:10px 50px">
|
2021-09-13 14:56:28 +08:00
|
|
|
|
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
|
|
|
|
<el-button type="primary" @click="addNew()">{{ 'btn.add' | i18nFilter }}</el-button>
|
2022-03-05 19:43:42 +08:00
|
|
|
|
</div> -->
|
|
|
|
|
<head-form
|
|
|
|
|
:placeholder-name="placeholderName"
|
|
|
|
|
:key-name="keyNameAdd"
|
|
|
|
|
@getDataList="getList"
|
|
|
|
|
@add="addNew"
|
|
|
|
|
/>
|
2022-03-13 14:44:14 +08:00
|
|
|
|
<div style="title">{{ sheCode }}:{{ shCode }} {{ sheName }}:{{ shName }} {{ locaNum }}:{{ num }}
|
2022-03-10 21:15:33 +08:00
|
|
|
|
<el-button type="success" @click="goback()">{{ 'btn.back' | i18nFilter }}</el-button>
|
|
|
|
|
</div>
|
2021-09-13 14:56:28 +08:00
|
|
|
|
<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'
|
2022-03-05 19:43:42 +08:00
|
|
|
|
import HeadForm from '@/components/basicData/HeadForm'
|
2021-09-13 14:56:28 +08:00
|
|
|
|
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'
|
|
|
|
|
/**
|
|
|
|
|
* 表格表头配置项 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 = [
|
2022-03-03 20:48:59 +08:00
|
|
|
|
// {
|
|
|
|
|
// prop: 'createTime',
|
|
|
|
|
// label: i18n.t('module.basicData.factory.createTime'),
|
|
|
|
|
// filter: timeFormatter,
|
|
|
|
|
// align: 'center'
|
|
|
|
|
// },
|
2021-09-13 14:56:28 +08:00
|
|
|
|
{
|
2022-03-03 20:48:59 +08:00
|
|
|
|
prop: 'locationName',
|
|
|
|
|
label: i18n.t('module.basicData.cache.LocationName'),
|
2021-09-13 14:56:28 +08:00
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'code',
|
|
|
|
|
label: i18n.t('module.basicData.cache.LocationCode'),
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
2022-03-03 20:48:59 +08:00
|
|
|
|
prop: 'locationNameAlias',
|
|
|
|
|
label: i18n.t('module.basicData.cache.anotherName'),
|
2021-09-13 14:56:28 +08:00
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
2022-03-05 19:43:42 +08:00
|
|
|
|
prop: 'layers',
|
2022-03-03 20:48:59 +08:00
|
|
|
|
label: i18n.t('module.basicData.cache.rowMark'),
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'columns',
|
|
|
|
|
label: i18n.t('module.basicData.cache.columnMark'),
|
2021-09-13 14:56:28 +08:00
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
2022-03-13 14:44:14 +08:00
|
|
|
|
// {
|
|
|
|
|
// prop: 'locationType',
|
|
|
|
|
// label: i18n.t('module.basicData.cache.locationType'),
|
|
|
|
|
// align: 'center'
|
|
|
|
|
// },
|
2021-09-13 14:56:28 +08:00
|
|
|
|
{
|
2022-03-10 21:15:33 +08:00
|
|
|
|
prop: 'statusName',
|
2022-03-03 20:48:59 +08:00
|
|
|
|
label: i18n.t('module.basicData.cache.status'),
|
2021-09-13 14:56:28 +08:00
|
|
|
|
align: 'center'
|
2022-03-20 09:50:14 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'locationNumber',
|
|
|
|
|
label: i18n.t('module.basicData.cache.locationNumber'),
|
|
|
|
|
align: 'center'
|
2021-09-13 14:56:28 +08:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Location',
|
2022-03-05 19:43:42 +08:00
|
|
|
|
components: { BaseTable, MethodBtn, locationAttrAdd, HeadForm },
|
2021-09-13 14:56:28 +08:00
|
|
|
|
filters: {
|
|
|
|
|
statusFilter(status) {
|
|
|
|
|
const statusMap = {
|
|
|
|
|
published: 'success',
|
|
|
|
|
draft: 'info',
|
|
|
|
|
deleted: 'danger'
|
|
|
|
|
}
|
|
|
|
|
return statusMap[status]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2022-03-10 21:15:33 +08:00
|
|
|
|
shCode: '',
|
|
|
|
|
shName: '',
|
|
|
|
|
num: 0,
|
2021-09-13 14:56:28 +08:00
|
|
|
|
addOrUpdateVisible: false,
|
2022-03-05 19:43:42 +08:00
|
|
|
|
keyNameAdd: i18n.t('module.basicData.visual.keyword'),
|
|
|
|
|
placeholderName: this.$t('module.basicData.cache.LocationName'),
|
2021-09-13 14:56:28 +08:00
|
|
|
|
tableBtn,
|
|
|
|
|
trueWidth: 200,
|
|
|
|
|
tableProps,
|
2022-03-10 21:15:33 +08:00
|
|
|
|
list: [{
|
|
|
|
|
statusName: ''
|
|
|
|
|
}],
|
2021-09-13 14:56:28 +08:00
|
|
|
|
listLoading: true,
|
|
|
|
|
listQuery: {
|
2022-03-18 15:00:32 +08:00
|
|
|
|
name: '',
|
2021-09-13 14:56:28 +08:00
|
|
|
|
current: 1,
|
2022-03-18 15:00:32 +08:00
|
|
|
|
size: 20
|
|
|
|
|
// shelfId: '',
|
|
|
|
|
// id: ''
|
2022-03-13 14:44:14 +08:00
|
|
|
|
},
|
|
|
|
|
sheCode: this.$t('module.basicData.cache.sheCode'),
|
|
|
|
|
sheName: this.$t('module.basicData.cache.sheName'),
|
|
|
|
|
locaNum: this.$t('module.basicData.cache.locaNum')
|
2021-09-13 14:56:28 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.listQuery.shelfId = this.$route.query.id
|
2022-03-10 21:15:33 +08:00
|
|
|
|
this.shCode = this.$route.query.code
|
|
|
|
|
this.shName = this.$route.query.shelfName
|
2022-03-15 09:55:49 +08:00
|
|
|
|
this.num = this.$route.query.total
|
2021-09-13 14:56:28 +08:00
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleClick(raw) {
|
|
|
|
|
if (raw.type === 'delete') {
|
2022-03-03 20:48:59 +08:00
|
|
|
|
console.log(raw.data)
|
|
|
|
|
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}[${raw.data.locationName}]?`, this.$t('module.basicData.visual.Tips'), {
|
2021-09-13 14:56:28 +08:00
|
|
|
|
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
|
2022-03-05 19:43:42 +08:00
|
|
|
|
// shelfId与查询参数id关联
|
2022-03-18 15:00:32 +08:00
|
|
|
|
console.log(this.listQuery)
|
2022-03-05 19:43:42 +08:00
|
|
|
|
this.listQuery.id = this.listQuery.shelfId
|
2021-09-13 14:56:28 +08:00
|
|
|
|
locationList(this.listQuery).then(response => {
|
|
|
|
|
if (response.data.records) {
|
|
|
|
|
this.list = response.data.records
|
2022-03-03 20:48:59 +08:00
|
|
|
|
console.log(this.list)
|
2022-03-10 21:15:33 +08:00
|
|
|
|
// 1是Working Port,2是Buffer Port,3是Exception Port与status进行替换
|
|
|
|
|
for (var x = 0; x < this.list.length; x++) {
|
|
|
|
|
if (this.list[x].status === 1) {
|
|
|
|
|
this.list[x].statusName = 'Working Port'
|
|
|
|
|
} else if (this.list[x].status === 2) {
|
|
|
|
|
this.list[x].statusName = 'Buffer Port'
|
|
|
|
|
} else if (this.list[x].status === 3) {
|
|
|
|
|
this.list[x].statusName = 'Exception Port'
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-13 14:56:28 +08:00
|
|
|
|
} 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>
|