|
|
@@ -1,7 +1,25 @@
|
|
|
<template>
|
|
|
- <el-dialog :visible.sync="visible" title="物品信息" width="80vw">
|
|
|
- <el-form :model="searchForm" label-width="100px">
|
|
|
+ <el-dialog
|
|
|
+ :visible.sync="visible1"
|
|
|
+ :close-on-click-modal="true"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ append-to-body
|
|
|
+ width="80vw"
|
|
|
+ >
|
|
|
+ <el-form :model="searchForm" label-width="100px" >
|
|
|
<el-row>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="仓库名称:">
|
|
|
+ <el-select v-model="searchForm.warehouseId" style="width: 100%">
|
|
|
+ <el-option
|
|
|
+ v-for="item in warehouseList"
|
|
|
+ :key="item.id"
|
|
|
+ :value="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ ></el-option> </el-select
|
|
|
+ ></el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="列表维度:" prop="dimension">
|
|
|
<template>
|
|
|
@@ -135,8 +153,8 @@
|
|
|
label="规格"
|
|
|
:show-overflow-tooltip="true"
|
|
|
></el-table-column>
|
|
|
- <el-table-column
|
|
|
- v-if="dimension == 1"
|
|
|
+ <!-- <el-table-column
|
|
|
+
|
|
|
label="出库数量"
|
|
|
type="index"
|
|
|
width="100"
|
|
|
@@ -149,9 +167,9 @@
|
|
|
@input="handleInput(row, $event)"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column
|
|
|
- v-else
|
|
|
+ v-if="dimension == 3"
|
|
|
prop="batchNo"
|
|
|
label="批次号"
|
|
|
key="batchNo"
|
|
|
@@ -239,6 +257,20 @@
|
|
|
:show-overflow-tooltip="true"
|
|
|
></el-table-column>
|
|
|
</el-table>
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="tableList"
|
|
|
+ :selection.sync="selection"
|
|
|
+ row-key="id"
|
|
|
+ height="20vh"
|
|
|
+ :needPage="false"
|
|
|
+ >
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button type="primary" size="small" @click="add">添加</el-button>
|
|
|
+ <el-button size="small" @click="del">移除</el-button></template
|
|
|
+ >
|
|
|
+ </ele-pro-table>
|
|
|
<div style="text-align: right; padding: 10px">
|
|
|
<el-pagination
|
|
|
background
|
|
|
@@ -263,197 +295,279 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import storageApi from '@/api/warehouseManagement';
|
|
|
- import AssetTree from './assetTree.vue';
|
|
|
- export default {
|
|
|
- components: { AssetTree },
|
|
|
- props: {
|
|
|
- treeIds: { type: Array, default: () => [] }
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- isShowTable: true,
|
|
|
- qualityResultOption: [
|
|
|
- {
|
|
|
- value: 0,
|
|
|
- label: '合格'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 1,
|
|
|
- label: '不合格'
|
|
|
- }
|
|
|
- ],
|
|
|
- qualityStatusOption: [
|
|
|
- {
|
|
|
- value: 1,
|
|
|
- label: '已质检'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 0,
|
|
|
- label: '未质检'
|
|
|
- }
|
|
|
- ],
|
|
|
- visible: false,
|
|
|
- tableData: [],
|
|
|
- total: 0,
|
|
|
- categoryLevelId: '',
|
|
|
- searchForm: {
|
|
|
- categoryCode: '',
|
|
|
- categoryName: '',
|
|
|
- batchNo: '',
|
|
|
- brandNum: '',
|
|
|
- engrave: '',
|
|
|
- barcodes: '',
|
|
|
- categoryLevelId: '',
|
|
|
- pageNum: 1,
|
|
|
- size: 20
|
|
|
+import storageApi from '@/api/warehouseManagement';
|
|
|
+import AssetTree from './assetTree.vue';
|
|
|
+import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: { AssetTree },
|
|
|
+ props: {
|
|
|
+ treeIds: { type: Array, default: () => [] }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isShowTable: true,
|
|
|
+ qualityResultOption: [
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '合格'
|
|
|
},
|
|
|
- selectionList: [],
|
|
|
- materialType: '',
|
|
|
- warehouseList: [],
|
|
|
- dimension: '1'
|
|
|
- };
|
|
|
- },
|
|
|
- created() {},
|
|
|
- methods: {
|
|
|
- getRowKeys(row) {
|
|
|
- return row.id;
|
|
|
- },
|
|
|
- // 出库数量限制
|
|
|
- handleInput(row, value) {
|
|
|
- if (row.outboundNum <= row.measureQuantity) {
|
|
|
- return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
|
|
|
- } else {
|
|
|
- row.outboundNum = row.measureQuantity;
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '不合格'
|
|
|
}
|
|
|
- },
|
|
|
- // 切换维度
|
|
|
- changeDimensionHandler(e) {
|
|
|
- this.searchForm.pageNum = 1;
|
|
|
- this.selectionList = [];
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
- this.changeDimension(e);
|
|
|
- },
|
|
|
- async changeDimension(e) {
|
|
|
- this.dimension = e;
|
|
|
- if (this.dimension == 1) {
|
|
|
- // 物品维度
|
|
|
- const data = await storageApi.getProductList(this.searchForm);
|
|
|
- this.tableData = data.list;
|
|
|
- this.total = data.count;
|
|
|
- } else if (this.dimension == 2) {
|
|
|
- // 批次维度
|
|
|
- const data = await storageApi.getBatchList(this.searchForm);
|
|
|
- this.tableData = data.list;
|
|
|
- this.total = data.count;
|
|
|
- } else if (this.dimension == 4) {
|
|
|
- // 物料维度
|
|
|
- const data = await storageApi.getMaterialList(this.searchForm);
|
|
|
- this.tableData = data.list;
|
|
|
- this.total = data.count;
|
|
|
- } else {
|
|
|
- // 包装维度
|
|
|
- const data = await storageApi.getPackingList(this.searchForm);
|
|
|
- this.tableData = data.list;
|
|
|
- this.total = data.count;
|
|
|
+ ],
|
|
|
+ qualityStatusOption: [
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '已质检'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '未质检'
|
|
|
}
|
|
|
- console.log(this.tableData);
|
|
|
+ ],
|
|
|
+ visible1: false,
|
|
|
+ tableData: [],
|
|
|
+ total: 0,
|
|
|
+ categoryLevelId: '',
|
|
|
+ warehouseList:[],
|
|
|
+ searchForm: {
|
|
|
+ categoryCode: '',
|
|
|
+ categoryName: '',
|
|
|
+ batchNo: '',
|
|
|
+ brandNum: '',
|
|
|
+ engrave: '',
|
|
|
+ barcodes: '',
|
|
|
+ categoryLevelId: '',
|
|
|
+ warehouseId: '',
|
|
|
+ pageNum: 1,
|
|
|
+ size: 20
|
|
|
},
|
|
|
- open() {
|
|
|
- this.visible = true;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.treeList.getTreeData().then((data) => {
|
|
|
- this.handleNodeClick(data);
|
|
|
- });
|
|
|
+ selectionList: [],
|
|
|
+ materialType: '',
|
|
|
+ warehouseList: [],
|
|
|
+ dimension: '1',
|
|
|
+ selection: [],
|
|
|
+ tableList: [],
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'categoryCode',
|
|
|
+ label: '物品编码',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryName',
|
|
|
+ label: '物品名称',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'categoryModel',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'level',
|
|
|
+ label: '级别',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'measureQuantity',
|
|
|
+ label: '库存',
|
|
|
+ align: 'center'
|
|
|
+ }, {
|
|
|
+ prop: 'measureUnit',
|
|
|
+ label: '计量单位',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'warehouseName',
|
|
|
+ label: '仓库',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ warehouseDefinition.list({}).then((res) => {
|
|
|
+ this.warehouseList = res;
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getRowKeys(row) {
|
|
|
+ return row.id;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 切换维度
|
|
|
+ changeDimensionHandler(e) {
|
|
|
+ this.searchForm.pageNum = 1;
|
|
|
+ this.selectionList = [];
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
+ this.changeDimension(e);
|
|
|
+ },
|
|
|
+ async changeDimension(e) {
|
|
|
+ this.dimension = e;
|
|
|
+ if (this.dimension == 1) {
|
|
|
+ // 物品维度
|
|
|
+ const data = await storageApi.getProductList(this.searchForm);
|
|
|
+ this.tableData = data.list;
|
|
|
+ this.total = data.count;
|
|
|
+ } else if (this.dimension == 2) {
|
|
|
+ // 批次维度
|
|
|
+ const data = await storageApi.getBatchList(this.searchForm);
|
|
|
+ this.tableData = data.list;
|
|
|
+ this.total = data.count;
|
|
|
+ } else if (this.dimension == 4) {
|
|
|
+ // 物料维度
|
|
|
+ const data = await storageApi.getMaterialList(this.searchForm);
|
|
|
+ this.tableData = data.list;
|
|
|
+ this.total = data.count;
|
|
|
+ } else {
|
|
|
+ // 包装维度
|
|
|
+ const data = await storageApi.getPackingList(this.searchForm);
|
|
|
+ this.tableData = data.list;
|
|
|
+ this.total = data.count;
|
|
|
+ }
|
|
|
+ console.log(this.tableData);
|
|
|
+ },
|
|
|
+ open(tableList) {
|
|
|
+ this.visible1 = true;
|
|
|
+ this.tableList = JSON.parse(JSON.stringify(tableList));
|
|
|
+ this.$nextTick(() => {
|
|
|
+ console.log(this.$refs, 'this.$refs.treeList');
|
|
|
+ this.$refs.treeList.getTreeData().then((data) => {
|
|
|
+ this.handleNodeClick(data);
|
|
|
});
|
|
|
- },
|
|
|
- async confirm() {
|
|
|
- if (!this.selectionList.length) {
|
|
|
- this.$message.error('请至少选择一条数据!');
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.dimension == 1) {
|
|
|
- let boolen = this.selectionList.every((item) => item.outboundNum > 0);
|
|
|
- if (!boolen) {
|
|
|
- this.$message.error('请输入出库数量!');
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- console.log(this.selectionList);
|
|
|
- let data = null;
|
|
|
- if (this.dimension != 1) {
|
|
|
- data = await storageApi.getHierarchyList({
|
|
|
- ids: this.selectionList.map((item) => item.id).join(','),
|
|
|
- type: this.dimension
|
|
|
- });
|
|
|
- } else {
|
|
|
- data = await storageApi.getHierarchyFifo({
|
|
|
- type: this.dimension,
|
|
|
- builders: this.selectionList.map((item) => {
|
|
|
- return {
|
|
|
- categoryId: item.categoryId,
|
|
|
- num: item.outboundNum
|
|
|
- };
|
|
|
- })
|
|
|
- });
|
|
|
- }
|
|
|
- console.log('data-------------------', data);
|
|
|
- this.$emit('detailData', data, this.dimension);
|
|
|
- this.cancel();
|
|
|
- },
|
|
|
- cancel() {
|
|
|
- this.selectionList = [];
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
- this.visible = false;
|
|
|
- },
|
|
|
- handleSelectionChange(val) {
|
|
|
- this.selectionList = val;
|
|
|
- },
|
|
|
- handleNodeClick(data) {
|
|
|
- console.log(data);
|
|
|
- this.categoryLevelId = data.id;
|
|
|
- this.searchForm.categoryLevelId = data.id;
|
|
|
- this.doSearch();
|
|
|
- },
|
|
|
- handleCurrentChange() {
|
|
|
- this.changeDimension(this.dimension);
|
|
|
- },
|
|
|
- reset() {
|
|
|
- this.searchForm = {
|
|
|
- categoryCode: '',
|
|
|
- categoryName: '',
|
|
|
- batchNo: '',
|
|
|
- brandNum: '',
|
|
|
- engrave: '',
|
|
|
- barcodes: '',
|
|
|
- categoryLevelId: this.categoryLevelId,
|
|
|
- pageNum: 1,
|
|
|
- size: 20
|
|
|
- };
|
|
|
- this.doSearch();
|
|
|
- },
|
|
|
- doSearch() {
|
|
|
- this.searchForm.pageNum = 1;
|
|
|
- this.changeDimension(this.dimension);
|
|
|
- },
|
|
|
- handleSizeChange() {
|
|
|
- this.searchForm.pageNum = 1;
|
|
|
- this.changeDimension(this.dimension, 'page');
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async confirm() {
|
|
|
+ this.$emit('choose', this.tableList, this.dimension);
|
|
|
+ this.cancel();
|
|
|
+ },
|
|
|
+ async add() {
|
|
|
+ if (!this.selectionList.length) {
|
|
|
+ this.$message.error('请至少选择一条数据!');
|
|
|
+ return;
|
|
|
}
|
|
|
+ // if (this.dimension == 1) {
|
|
|
+ // let boolen = this.selectionList.every((item) => item.outboundNum > 0);
|
|
|
+ // if (!boolen) {
|
|
|
+ // this.$message.error('请输入出库数量!');
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // let data = null;
|
|
|
+ // if (this.dimension != 1) {
|
|
|
+ // data = await storageApi.getHierarchyList({
|
|
|
+ // ids: this.selectionList.map((item) => item.id).join(','),
|
|
|
+ // type: this.dimension
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // data = await storageApi.getHierarchyFifo({
|
|
|
+ // type: this.dimension,
|
|
|
+ // builders: this.selectionList.map((item) => {
|
|
|
+ // return {
|
|
|
+ // categoryId: item.categoryId,
|
|
|
+ // num: item.outboundNum || item.measureQuantity
|
|
|
+ // };
|
|
|
+ // })
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
+ this.selectionList = this.selectionList.filter((item) => {
|
|
|
+ if(item.warehouseList.length>0){
|
|
|
+ item['warehouseId']=item.warehouseList[0].warehouse_id
|
|
|
+ item['warehouseName']=item.warehouseList[0].warehouse_name
|
|
|
+ }
|
|
|
+ return !this.tableList
|
|
|
+ .map((item) => item.categoryCode)
|
|
|
+ .includes(item.categoryCode);
|
|
|
+ });
|
|
|
+ this.tableList.push(...this.selectionList);
|
|
|
+ },
|
|
|
+ del() {
|
|
|
+ let ids = this.selection.map((item) => item.id);
|
|
|
+ this.tableList = this.tableList.filter((item) => !ids.includes(item.id));
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+ this.selectionList = [];
|
|
|
+ this.$refs.multipleTable.clearSelection();
|
|
|
+ this.visible1 = false;
|
|
|
+ },
|
|
|
+ handleSelectionChange(val) {
|
|
|
+ this.selectionList = val;
|
|
|
+ },
|
|
|
+ handleNodeClick(data) {
|
|
|
+ console.log(data);
|
|
|
+ this.categoryLevelId = data.id;
|
|
|
+ this.searchForm.categoryLevelId = data.id;
|
|
|
+ this.doSearch();
|
|
|
+ },
|
|
|
+ handleCurrentChange() {
|
|
|
+ this.changeDimension(this.dimension);
|
|
|
+ },
|
|
|
+ reset() {
|
|
|
+ this.searchForm = {
|
|
|
+ categoryCode: '',
|
|
|
+ categoryName: '',
|
|
|
+ batchNo: '',
|
|
|
+ brandNum: '',
|
|
|
+ engrave: '',
|
|
|
+ barcodes: '',
|
|
|
+ categoryLevelId: this.categoryLevelId,
|
|
|
+ pageNum: 1,
|
|
|
+ warehouseId: '',
|
|
|
+ size: 20
|
|
|
+ };
|
|
|
+ this.doSearch();
|
|
|
+ },
|
|
|
+ doSearch() {
|
|
|
+ this.searchForm.pageNum = 1;
|
|
|
+ this.changeDimension(this.dimension);
|
|
|
+ },
|
|
|
+ handleSizeChange() {
|
|
|
+ this.searchForm.pageNum = 1;
|
|
|
+ this.changeDimension(this.dimension, 'page');
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .el-dialog__wrapper {
|
|
|
- ::v-deep .el-aside {
|
|
|
- background-color: #fff !important;
|
|
|
- border: 1px solid #ccc;
|
|
|
- }
|
|
|
+.el-dialog__wrapper {
|
|
|
+ ::v-deep .el-aside {
|
|
|
+ background-color: #fff !important;
|
|
|
+ border: 1px solid #ccc;
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- .wrapper-assets {
|
|
|
- max-height: 53vh;
|
|
|
- overflow: auto;
|
|
|
- }
|
|
|
+.wrapper-assets {
|
|
|
+ max-height: 53vh;
|
|
|
+ overflow: auto;
|
|
|
+}
|
|
|
</style>
|