<template>
|
<TableLayout v-permissions="['ext:warehouselocationext:query']">
|
<!-- 搜索表单 -->
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-suffix=":" label-width="100px" inline>
|
<el-form-item label="仓库名称" prop="warehouseId">
|
<el-select v-model="searchForm.warehouseId" clearable filterable placeholder="请选择">
|
<el-option
|
v-for="item in options"
|
:key="item.value"
|
:label="item.name"
|
:value="item.id"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="货位组合" prop="unionName">
|
<el-input v-model="searchForm.unionName" placeholder="请输入" v-trim/>
|
</el-form-item>
|
<el-form-item label="货位编码" prop="code">
|
<el-input v-model="searchForm.code" placeholder="请输入" v-trim/>
|
</el-form-item>
|
<el-form-item label="货位属性" prop="systemDicDataId">
|
<el-select v-model="searchForm.systemDicDataId" clearable placeholder="请选择">
|
<el-option
|
v-for="item in properties"
|
:key="item.value"
|
:label="item.code"
|
:value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="货位状态" prop="status">
|
<el-select v-model="searchForm.status" clearable placeholder="请选择">
|
<el-option
|
v-for="item in status"
|
:key="item.value"
|
:label="item.name"
|
:value="item.id"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<!-- 表格和分页 -->
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li><el-button type="primary" @click="$refs.operaWarehouseLocationExtWindow.open('新建库位')" v-permissions="['ext:warehouselocationext:create']">新增</el-button></li>
|
<li><el-button type="primary" v-if="containPermissions(['ext:barcodeparamext:query'])" @click="printLabelWithArray()" plain>打印标签</el-button></li>
|
</ul>
|
<el-table
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
border
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55"></el-table-column>
|
<el-table-column prop="code" label="货位编码" show-overflow-tooltip min-width="100px">
|
<template slot-scope="{row}">
|
<span class="long-title-style">{{row.code}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="unionName" label="货位组合" show-overflow-tooltip min-width="100px">
|
<template slot-scope="{row}">
|
<span class="long-title-style">{{row.unionName}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="tmodel.code" label="货位属性" min-width="60px"></el-table-column>
|
<el-table-column prop="wmodel.name" label="所属仓库" show-overflow-tooltip min-width="100px">
|
<template slot-scope="{row}">
|
<span class="long-title-style">{{row.wmodel.name}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="货位状态" min-width="60px">
|
<template slot-scope="{row}">
|
<span v-if="row.status === 1" class="valid-style">启用</span>
|
<span v-else-if="row.status === 0" class="unvalid-style">禁用</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="createTime" label="创建时间" min-width="100px"></el-table-column>
|
<el-table-column
|
label="操作"
|
min-width="160px"
|
fixed="right"
|
>
|
<template slot-scope="{row}">
|
<div v-if="row.status == '1'">
|
<el-button type="text" @click="editWarehouseLocation(row)" v-permissions="['ext:warehouselocationext:update']">编辑</el-button>
|
<el-button type="text" v-if="containPermissions(['ext:barcodeparamext:query'])" @click="printLabel(row)" class="unvalid-style">打印标签</el-button>
|
<span style="margin: 8px;">
|
<el-button type="text" @click="unvalidWithArray(row)" v-permissions="['ext:warehouselocationext:delete']">失效</el-button>
|
</span>
|
</div>
|
<div v-else>-</div>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
></pagination>
|
</template>
|
<!-- 新建/修改 -->
|
<OperaWarehouseLocationExtWindow ref="operaWarehouseLocationExtWindow" @success="handlePageChange"/>
|
<QrCodeLabel ref="qrCodeLabel"></QrCodeLabel>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import OperaWarehouseLocationExtWindow from '@/components/ext/OperaWarehouseLocationExtWindow'
|
import QrCodeLabel from '@/components/common/QrCodeLabel'
|
import { queryListByJurisdiction as getAllData, upsateStatus } from '@/api/ext/warehouseLocationExt'
|
import { queryListByCode } from '@/api/system/dictData'
|
import { fetchList as getPrefix } from '@/api/ext/barcodeParamExt'
|
export default {
|
name: 'WarehouseLocationExt',
|
extends: BaseTable,
|
components: { TableLayout, Pagination, OperaWarehouseLocationExtWindow, QrCodeLabel },
|
data () {
|
return {
|
options: [
|
],
|
types: [
|
{ name: '原材料库', id: '0' },
|
{ name: '半成品库', id: '1' },
|
{ name: '成品库', id: '2' },
|
{ name: '不良品库', id: '3' },
|
{ name: '线边库', id: '4' }
|
],
|
status: [
|
{ name: '启用', id: '1' },
|
{ name: '禁用', id: '0' }
|
],
|
properties: [],
|
// 搜索
|
searchForm: {
|
warehouseId: null,
|
systemDicDataId: null,
|
unionName: null,
|
code: null,
|
status: null
|
},
|
printList: [],
|
prefix: ''
|
}
|
},
|
provide() {
|
return {
|
properties: () => this.properties,
|
options: () => this.options
|
}
|
},
|
created () {
|
this.config({
|
module: '货位信息',
|
api: '/ext/warehouseLocationExt',
|
'field.id': 'id',
|
'field.main': 'name',
|
sorts: [{ direction: 'DESC', property: 'CREATE_TIME' }]
|
})
|
queryListByCode('?dicCode=SYSTEM_APPLIANCE_TYPE')
|
.then(res => {
|
this.properties = res
|
})
|
.catch(err => {
|
console.log(err)
|
})
|
this.search()
|
this.getName()
|
getPrefix({
|
page: 1,
|
capacity: 1,
|
model: { type: 2, status: 1 }
|
})
|
.then(res => {
|
this.prefix = res.records[0].prefix
|
})
|
},
|
methods: {
|
// 仓库名称
|
getName () {
|
getAllData({ useLocation: 1, departId: this.$store.state.userInfo.curComDepartment.id, status: 1 })
|
.then((res) => {
|
this.options = res
|
})
|
},
|
editWarehouseLocation (row) {
|
row.systemDicDataId = parseInt(row.systemDicDataId)
|
// console.log(row)
|
this.$refs.operaWarehouseLocationExtWindow.open('编辑货位信息', row)
|
},
|
printLabel (row) {
|
console.log('打印标签', row)
|
this.printList = [{
|
code: row.code,
|
title: row.wmodel.name,
|
content: row.unionName,
|
department: this.$store.state.userInfo.curComDepartment.name
|
}]
|
this.$refs.qrCodeLabel.open('打印标签', this.printList, this.prefix)
|
},
|
printLabelWithArray () {
|
if (this.tableData.selectedRows.length === 0) {
|
this.$tip.warning('请至少选择一条数据')
|
return
|
}
|
// console.log(this.tableData.selectedRows)
|
this.printList = this.tableData.selectedRows.map((item) => {
|
return {
|
code: item.code,
|
title: item.wmodel.name,
|
content: item.unionName,
|
department: this.$store.state.userInfo.curComDepartment.name
|
}
|
})
|
this.$refs.qrCodeLabel.open('打印标签', this.printList, this.prefix)
|
},
|
// 控制失效
|
unvalidWithArray (item) {
|
this.$confirm('是否修改此货位的状态?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
upsateStatus(item.id, '0')
|
.then(res => {
|
this.$tip.success('更新成功')
|
this.search()
|
})
|
.catch(err => {
|
this.$tip.error(err.message)
|
})
|
}).catch(() => {
|
|
})
|
},
|
objectSort(property) {
|
return function (Obj1,Obj2) {
|
return Obj1[property]-Obj2[property]
|
}
|
}
|
}
|
}
|
</script>
|