|
@@ -1,12 +1,26 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <el-dialog :visible.sync="visible" title="仓库" @before-close="cancel" width="50%" :close-on-click-modal="false">
|
|
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ :visible.sync="visible"
|
|
|
|
|
+ title="仓库"
|
|
|
|
|
+ @before-close="cancel"
|
|
|
|
|
+ width="50%"
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ >
|
|
|
<el-form :model="formData" label-width="100px">
|
|
<el-form :model="formData" label-width="100px">
|
|
|
<el-row>
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="选择仓库">
|
|
<el-form-item label="选择仓库">
|
|
|
- <el-select filterable v-model="warehouseId" @change="changeWarehouse">
|
|
|
|
|
- <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name"
|
|
|
|
|
- :value="item.id"></el-option>
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ filterable
|
|
|
|
|
+ v-model="warehouseId"
|
|
|
|
|
+ @change="changeWarehouse"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="(item, index) in warehouseList"
|
|
|
|
|
+ :key="index"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
@@ -17,13 +31,15 @@
|
|
|
<el-form-item label="总包装数量">
|
|
<el-form-item label="总包装数量">
|
|
|
<span class="red_color">
|
|
<span class="red_color">
|
|
|
{{ this.packingQuantity }}
|
|
{{ this.packingQuantity }}
|
|
|
- </span></el-form-item>
|
|
|
|
|
|
|
+ </span></el-form-item
|
|
|
|
|
+ >
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
<el-col :span="6">
|
|
|
<el-form-item label="计量数量">
|
|
<el-form-item label="计量数量">
|
|
|
<span class="red_color">
|
|
<span class="red_color">
|
|
|
{{ this.measureQuantity }}
|
|
{{ this.measureQuantity }}
|
|
|
- </span></el-form-item>
|
|
|
|
|
|
|
+ </span></el-form-item
|
|
|
|
|
+ >
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
</el-form>
|
|
</el-form>
|
|
@@ -31,19 +47,31 @@
|
|
|
<el-table :data="tableDate" style="width: 100%">
|
|
<el-table :data="tableDate" style="width: 100%">
|
|
|
<el-table-column label="序号" type="index"></el-table-column>
|
|
<el-table-column label="序号" type="index"></el-table-column>
|
|
|
<el-table-column label="仓库名称" prop="warehouseName"></el-table-column>
|
|
<el-table-column label="仓库名称" prop="warehouseName"></el-table-column>
|
|
|
- <el-table-column label="包装数量" prop="packingQuantity" >
|
|
|
|
|
|
|
+ <el-table-column label="包装数量" prop="packingQuantity">
|
|
|
<template slot-scope="{ row, $index }">
|
|
<template slot-scope="{ row, $index }">
|
|
|
- <el-input-number v-model="row.packingQuantity" :min="0" size="mini" disabled></el-input-number>
|
|
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="row.packingQuantity"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ ></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="计量数量" prop="measureQuantity" >
|
|
|
|
|
|
|
+ <el-table-column label="计量数量" prop="measureQuantity">
|
|
|
<template slot-scope="{ row, $index }">
|
|
<template slot-scope="{ row, $index }">
|
|
|
- <el-input-number v-model="row.measureQuantity" :min="0" size="mini" disabled></el-input-number>
|
|
|
|
|
|
|
+ <el-input-number
|
|
|
|
|
+ v-model="row.measureQuantity"
|
|
|
|
|
+ :min="0"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ ></el-input-number>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column width="120" label="操作" fixed="right">
|
|
<el-table-column width="120" label="操作" fixed="right">
|
|
|
<template slot-scope="{ row, $index }">
|
|
<template slot-scope="{ row, $index }">
|
|
|
- <el-button type="text" @click="delItem($index)" size="small">删除</el-button>
|
|
|
|
|
|
|
+ <el-button type="text" @click="delItem($index)" size="small"
|
|
|
|
|
+ >删除</el-button
|
|
|
|
|
+ >
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -55,46 +83,46 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
|
|
|
|
|
-export default {
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- packingQuantity: 0,
|
|
|
|
|
- tableDate: [],
|
|
|
|
|
- visible: false,
|
|
|
|
|
- warehouseList: [], //仓库
|
|
|
|
|
- formData: {},
|
|
|
|
|
- warehouseId: '',
|
|
|
|
|
- currentIndex: 0,
|
|
|
|
|
- measureQuantity: 0
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- methods: {
|
|
|
|
|
- changeWarehouse() {
|
|
|
|
|
- this.tableDate = []
|
|
|
|
|
|
|
+ import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
|
|
|
|
|
+ export default {
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ packingQuantity: 0,
|
|
|
|
|
+ tableDate: [],
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ warehouseList: [], //仓库
|
|
|
|
|
+ formData: {},
|
|
|
|
|
+ warehouseId: '',
|
|
|
|
|
+ currentIndex: 0,
|
|
|
|
|
+ measureQuantity: 0
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
- cancel() {
|
|
|
|
|
- this.visible = false;
|
|
|
|
|
- },
|
|
|
|
|
- handleSelect() {
|
|
|
|
|
- if (this.tableDate.length == 0) {
|
|
|
|
|
- return this.$message.warning('请添加仓库!');
|
|
|
|
|
- }
|
|
|
|
|
- let total = this.tableDate.reduce(
|
|
|
|
|
- (total, currentObj) =>
|
|
|
|
|
- Number(total) + Number(currentObj.packingQuantity),
|
|
|
|
|
- 0
|
|
|
|
|
- );
|
|
|
|
|
- if (total == this.packingQuantity) {
|
|
|
|
|
- console.log(this.tableDate,'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk');
|
|
|
|
|
- this.$emit('selection', this.tableDate, this.currentIndex);
|
|
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ changeWarehouse() {
|
|
|
|
|
+ this.tableDate = [];
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel() {
|
|
|
this.visible = false;
|
|
this.visible = false;
|
|
|
- } else {
|
|
|
|
|
- this.$message.warning('总包装数量与仓库包装数量不一致!');
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- addTableData() {
|
|
|
|
|
- // if (this.tableDate.length < this.packingQuantity) {
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ handleSelect() {
|
|
|
|
|
+ if (this.tableDate.length == 0) {
|
|
|
|
|
+ return this.$message.warning('请添加仓库!');
|
|
|
|
|
+ }
|
|
|
|
|
+ let total = this.tableDate.reduce(
|
|
|
|
|
+ (total, currentObj) =>
|
|
|
|
|
+ Number(total) + Number(currentObj.packingQuantity),
|
|
|
|
|
+ 0
|
|
|
|
|
+ );
|
|
|
|
|
+ if (total == this.packingQuantity) {
|
|
|
|
|
+ console.log(this.tableDate, 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkk');
|
|
|
|
|
+ this.$emit('selection', this.tableDate, this.currentIndex);
|
|
|
|
|
+ this.visible = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.warning('总包装数量与仓库包装数量不一致!');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ addTableData() {
|
|
|
|
|
+ // if (this.tableDate.length < this.packingQuantity) {
|
|
|
let list = this.tableDate.filter(
|
|
let list = this.tableDate.filter(
|
|
|
(item) => item.warehouseId == this.warehouseId
|
|
(item) => item.warehouseId == this.warehouseId
|
|
|
);
|
|
);
|
|
@@ -110,51 +138,89 @@ export default {
|
|
|
)[0].name,
|
|
)[0].name,
|
|
|
warehouseId: this.warehouseId
|
|
warehouseId: this.warehouseId
|
|
|
});
|
|
});
|
|
|
- // } else {
|
|
|
|
|
- // this.$message.warning('请维护包装规格后再添加仓库!');
|
|
|
|
|
- // }
|
|
|
|
|
- },
|
|
|
|
|
- delItem(index) {
|
|
|
|
|
- // if (index == 0 && this.tableDate.length == 1) {
|
|
|
|
|
- // return this.$message.warning('请至少保存一条数据!');
|
|
|
|
|
- // }
|
|
|
|
|
- this.tableDate.splice(index, 1);
|
|
|
|
|
- },
|
|
|
|
|
- async getWarehouseList(categoryType) {
|
|
|
|
|
- const res = await warehouseDefinition.list({ inventoryType: categoryType });
|
|
|
|
|
- console.log(res);
|
|
|
|
|
- this.warehouseList = res.map((item) => {
|
|
|
|
|
- return { ...item, name: item.name };
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- open(packingQuantity, measureQuantity,idx, warehouseId, warehouseName, categoryType) {
|
|
|
|
|
- console.log('仓库id', packingQuantity, measureQuantity, warehouseId, warehouseName);
|
|
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // this.$message.warning('请维护包装规格后再添加仓库!');
|
|
|
|
|
+ // }
|
|
|
|
|
+ },
|
|
|
|
|
+ delItem(index) {
|
|
|
|
|
+ // if (index == 0 && this.tableDate.length == 1) {
|
|
|
|
|
+ // return this.$message.warning('请至少保存一条数据!');
|
|
|
|
|
+ // }
|
|
|
|
|
+ this.tableDate.splice(index, 1);
|
|
|
|
|
+ },
|
|
|
|
|
+ async getWarehouseList(categoryType) {
|
|
|
|
|
+ const res = await warehouseDefinition.list({
|
|
|
|
|
+ inventoryType: categoryType
|
|
|
|
|
+ });
|
|
|
|
|
+ this.warehouseList = res.map((item) => {
|
|
|
|
|
+ return { ...item, name: item.name };
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ async getBatchWarehouseList(batch) {
|
|
|
|
|
+ const res = await warehouseDefinition.list({});
|
|
|
|
|
+ if (!batch.length) {
|
|
|
|
|
+ this.warehouseList = res.map((item) => {
|
|
|
|
|
+ return { ...item, name: item.name };
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.warehouseId = '';
|
|
|
|
|
- this.tableDate = [];
|
|
|
|
|
- this.currentIndex = idx;
|
|
|
|
|
- this.packingQuantity = packingQuantity;
|
|
|
|
|
- this.measureQuantity = measureQuantity;
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
- this.getWarehouseList(categoryType);
|
|
|
|
|
- if (warehouseId && warehouseName) {
|
|
|
|
|
- this.warehouseId = warehouseId;
|
|
|
|
|
- this.tableDate.push({
|
|
|
|
|
- packingQuantity: packingQuantity,
|
|
|
|
|
- measureQuantity: measureQuantity,
|
|
|
|
|
- warehouseName: warehouseName,
|
|
|
|
|
- warehouseId: warehouseId
|
|
|
|
|
|
|
+ let filter = res.filter((item) => batch.includes(item.inventoryType));
|
|
|
|
|
+ this.warehouseList = filter.map((item) => {
|
|
|
|
|
+ return { ...item, name: item.name };
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+ open({
|
|
|
|
|
+ packingQuantity,
|
|
|
|
|
+ measureQuantity,
|
|
|
|
|
+ idx,
|
|
|
|
|
+ warehouseId,
|
|
|
|
|
+ warehouseName,
|
|
|
|
|
+ categoryType,
|
|
|
|
|
+ batch
|
|
|
|
|
+ } = obj) {
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ '仓库id',
|
|
|
|
|
+ packingQuantity,
|
|
|
|
|
+ measureQuantity,
|
|
|
|
|
+ warehouseId,
|
|
|
|
|
+ warehouseName
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ this.warehouseId = '';
|
|
|
|
|
+ this.tableDate = [];
|
|
|
|
|
+ this.currentIndex = idx;
|
|
|
|
|
+ this.packingQuantity = packingQuantity;
|
|
|
|
|
+ this.measureQuantity = measureQuantity;
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
+
|
|
|
|
|
+ console.log(batch);
|
|
|
|
|
+
|
|
|
|
|
+ if (!batch) {
|
|
|
|
|
+ this.getWarehouseList(categoryType);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.getBatchWarehouseList(batch);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // this.getWarehouseList(categoryType);
|
|
|
|
|
+ if (warehouseId && warehouseName) {
|
|
|
|
|
+ this.warehouseId = warehouseId;
|
|
|
|
|
+ this.tableDate.push({
|
|
|
|
|
+ packingQuantity: packingQuantity,
|
|
|
|
|
+ measureQuantity: measureQuantity,
|
|
|
|
|
+ warehouseName: warehouseName,
|
|
|
|
|
+ warehouseId: warehouseId
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ };
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-.red_color {
|
|
|
|
|
- font-size: 20px;
|
|
|
|
|
- font-weight: bold;
|
|
|
|
|
- color: red;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ .red_color {
|
|
|
|
|
+ font-size: 20px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ color: red;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|