wms-njlm/src/views/fpw/finishWarehouseStorehouseStorage/index.vue
2023-10-25 16:44:11 +08:00

280 lines
6.6 KiB
Vue

<template>
<div class="app-container">
<search-bar
:isFold="true"
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-table
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
v-loading="dataListLoading"
style="width: 100%"
ref="dataList">
<el-table-column type="expand">
<template slot-scope="scope">
<product :warehouse-id="scope.row.id" :prop-type="2"></product>
</template>
</el-table-column>
<el-table-column
prop="finishProductName"
label="库位名"></el-table-column>
<el-table-column
prop="finishProductCode"
label="库位编码"></el-table-column>
<el-table-column prop="finishProductWarehouseState" label="库位状态">
<template slot-scope="scope">
<span>
{{
scope.row.finishProductWarehouseState >= 0
? warehouseStorehouseState[
scope.row.finishProductWarehouseState
].name
: ''
}}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template v-slot="scope">
<span v-if="scope.row.deactivate === 1">
<el-button
size="mini"
type="text"
@click="handleClick({ data: { id: scope.row }, type: 'setList' })"
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
编辑
</el-button>
<el-button
size="mini"
v-if="scope.row.finishProductWarehouseState === 0"
type="text"
@click="handleClick({ data: { id: scope.row }, type: 'in' })"
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
入库
</el-button>
<el-popconfirm
@confirm="setShipment(scope.row.id)"
v-if="scope.row.finishProductWarehouseState === 1"
placement="top"
:title="
'你确定要把 <' + scope.row.finishProductName + '> 库位出货吗?'
">
<el-button
style="margin-left: 10px"
slot="reference"
size="mini"
v-if="scope.row.finishProductWarehouseState === 1"
type="text"
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
出库
</el-button>
</el-popconfirm>
</span>
<span v-else>
<el-button
size="mini"
type="text"
@click="handleClick({ data: { id: scope.row }, type: 'restore' })"
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
启用库位
</el-button>
</span>
</template>
</el-table-column>
</el-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<add-or-update
v-if="drawerVisible"
ref="drawerRef"
:prop-type="2"
@refreshDataList="getDataList" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import product from '../product-mini';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import {
getFinishProductWarehousePage,
outFinishProductWarehouse,
updateFinishProductWarehouse,
} from '@/api/fpw/finishProductWarehouse';
const warehouseStorehouseState = [
{
name: '空',
id: 0,
},
{
name: '满',
id: 1,
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getFinishProductWarehousePage,
},
tableData: [],
drawerVisible: false,
warehouseStorehouseState,
formConfig: [
{
type: 'input',
label: '库位名',
placeholder: '库位名',
param: 'name',
},
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'code',
},
{
type: 'input',
label: '产品名',
placeholder: '产品名',
param: 'pname',
},
{
type: 'input',
label: '产品编码',
placeholder: '产品编码',
param: 'pcode',
},
{
type: 'select',
label: '库位状态',
selectOptions: warehouseStorehouseState,
param: 'warehouseStorehouseStateId',
defaultSelect: '',
filterable: true,
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '重置',
name: 'reset',
},
// {
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
// btnName: '导出',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
AddOrUpdate,
product,
},
created() {},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.finishProductName = val.name;
this.listQuery.finishProductCode = val.code;
this.listQuery.productName = val.pname;
this.listQuery.productCode = val.pcode;
this.listQuery.finishProductWarehouseState =
val.warehouseStorehouseStateId;
Object.keys(this.listQuery).forEach(
(key) =>
this.listQuery[key] === null ||
(this.listQuery[key] === '' && delete this.listQuery[key])
);
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(id);
});
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
otherMethods(val) {
if (val.type === 'setList') {
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(val.data.id, true);
});
} else if (val.type === 'in') {
this.drawerVisible = true;
this.$nextTick(() => {
this.$refs.drawerRef.init(val.data.id, false);
});
} else if (val.type === 'restore') {
const dataForm = {
id: val.data.id.id,
deactivate: 1,
trayCode:val.data.id.trayCode?val.data.id.trayCode:''
};
updateFinishProductWarehouse(dataForm).then((response) => {
this.$modal.msgSuccess('启用成功');
this.getDataList();
});
} else {
console.log(11);
}
},
setShipment(id) {
outFinishProductWarehouse(id).then((response) => {
this.$modal.msgSuccess('出库成功');
this.getDataList();
});
},
},
};
</script>
<style>
.app-container .el-table .el-table__cell {
padding: 0;
height: 35px;
}
</style>