|
|
@@ -1,21 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose">
|
|
|
- <div style="display: flex;align-items: center;">
|
|
|
- <dic-select
|
|
|
- v-if="dialogVisible"
|
|
|
- style="width: 300px;"
|
|
|
- v-model="query.dot"
|
|
|
- placeholder="批次号"
|
|
|
- label="dot"
|
|
|
- :disabled="disabled || query.historyList.length"
|
|
|
- :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
|
|
|
- :filterable="true"
|
|
|
- @selectChange="dicChange('dot', $event)"
|
|
|
- ></dic-select>
|
|
|
- <el-tag type="danger" style="margin-left: 10px;">库存数量:{{ qtyMax }}</el-tag>
|
|
|
- </div>
|
|
|
-
|
|
|
<avue-crud
|
|
|
v-if="dialogVisible"
|
|
|
:option="option"
|
|
|
@@ -25,24 +10,42 @@
|
|
|
id="out-table"
|
|
|
:header-cell-class-name="headerClassName"
|
|
|
>
|
|
|
- <template slot="callInReservoirAreaName" slot-scope="{ row }">
|
|
|
+ <template slot-scope="{ scope, row }" slot="menuLeft">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <el-button type="primary" size="small" @click="addRow">新增</el-button>
|
|
|
+ <dic-select
|
|
|
+ v-if="dialogVisible"
|
|
|
+ style="width: 300px;"
|
|
|
+ v-model="query.dot"
|
|
|
+ placeholder="批次号"
|
|
|
+ label="dot"
|
|
|
+ :disabled="disabled || query.historyList.length"
|
|
|
+ :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
|
|
|
+ :filterable="true"
|
|
|
+ :allowCreate="true"
|
|
|
+ ></dic-select>
|
|
|
+ <el-tag type="danger" style="margin-left: 10px;">入库数量:{{ qtyMax }}</el-tag>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot="reservoirAreaName" slot-scope="{ row }">
|
|
|
<dic-select
|
|
|
- :key="callInStorageId"
|
|
|
- v-model="row.callInReservoirAreaName"
|
|
|
+ v-model="row.reservoirAreaName"
|
|
|
placeholder="库区"
|
|
|
label="cname"
|
|
|
res="records"
|
|
|
- :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + callInStorageId"
|
|
|
+ :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + form.storageId"
|
|
|
:filterable="true"
|
|
|
:remote="true"
|
|
|
dataName="cname"
|
|
|
:disabled="disabled"
|
|
|
- @selectChange="rowDicChange('callInReservoirAreaName', $event, row)"
|
|
|
+ @selectChange="rowDicChange('reservoirAreaName', $event, row)"
|
|
|
+ :slotRight="true"
|
|
|
+ rightLabel="balanceQuantity"
|
|
|
></dic-select>
|
|
|
</template>
|
|
|
- <template slot="quantity" slot-scope="{ row }">
|
|
|
+ <template slot="quantityFinancing" slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
- v-model="row.quantity"
|
|
|
+ v-model="row.quantityFinancing"
|
|
|
size="small"
|
|
|
:controls="false"
|
|
|
style="width: 100%"
|
|
|
@@ -51,6 +54,20 @@
|
|
|
@change="qtyChange(row)"
|
|
|
/>
|
|
|
</template>
|
|
|
+ <template slot="quantityHave" slot-scope="{ row }">
|
|
|
+ <el-input-number
|
|
|
+ v-model="row.quantityHave"
|
|
|
+ size="small"
|
|
|
+ :controls="false"
|
|
|
+ style="width: 100%"
|
|
|
+ :max="row.balanceQuantity"
|
|
|
+ :disabled="disabled"
|
|
|
+ @change="qtyChange2(row)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="menu">
|
|
|
+ <el-button icon="el-icon-delete" :disabled="disabled" size="small" type="text" @click="rowDel(row, index)">删除 </el-button>
|
|
|
+ </template>
|
|
|
</avue-crud>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false" size="mini">取 消</el-button>
|
|
|
@@ -61,10 +78,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { selectReservoirAreaList } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
|
|
|
-import { head } from "lodash";
|
|
|
-import { isProcurement } from "@/api/basicData/configuration";
|
|
|
import dicSelect from "@/components/dicSelect/main";
|
|
|
+import { itemRemove } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
|
|
|
export default {
|
|
|
props: {
|
|
|
disabled: {
|
|
|
@@ -77,47 +92,47 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- callInStorageId: null,
|
|
|
data: [],
|
|
|
dialogVisible: false,
|
|
|
loading: false,
|
|
|
option: {
|
|
|
height: 500,
|
|
|
calcHeight: 30,
|
|
|
+ menuWidth: 80,
|
|
|
border: true,
|
|
|
index: true,
|
|
|
addBtn: false,
|
|
|
viewBtn: false,
|
|
|
delBtn: false,
|
|
|
editBtn: false,
|
|
|
- menu: false,
|
|
|
- header: false,
|
|
|
+ refreshBtn: false,
|
|
|
+ columnBtn: false,
|
|
|
+ // menu: false,
|
|
|
+ // header: false,
|
|
|
column: [
|
|
|
{
|
|
|
label: "库区",
|
|
|
prop: "reservoirAreaName",
|
|
|
- filters: true,
|
|
|
- sortable: true,
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
|
- label: "批次",
|
|
|
- prop: "dot",
|
|
|
+ label: "库存",
|
|
|
+ prop: "balanceQuantity",
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
|
- label: "库存",
|
|
|
- prop: "balanceQuantity",
|
|
|
+ label: "本次数量",
|
|
|
+ prop: "quantity",
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
|
- label: "调入库库区",
|
|
|
- prop: "callInReservoirAreaName",
|
|
|
+ label: "本次融资数量",
|
|
|
+ prop: "quantityFinancing",
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
|
- label: "本次数量",
|
|
|
- prop: "quantity",
|
|
|
+ label: "本次自有数量",
|
|
|
+ prop: "quantityHave",
|
|
|
overHidden: true
|
|
|
}
|
|
|
]
|
|
|
@@ -130,27 +145,43 @@ export default {
|
|
|
},
|
|
|
async created() {},
|
|
|
methods: {
|
|
|
- rowDicChange(name, row, el) {
|
|
|
- if (name == "callInReservoirAreaName") {
|
|
|
- if (row) {
|
|
|
- el.callInReservoirAreaId = row.id;
|
|
|
+ rowDel(row, index) {
|
|
|
+ this.$confirm("确定删除数据?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ if (row.id) {
|
|
|
+ itemRemove({ ids: row.id }).then(res => {
|
|
|
+ this.data.splice(index, 1);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ });
|
|
|
} else {
|
|
|
- el.callInReservoirAreaId = null;
|
|
|
- el.callInReservoirAreaName = null;
|
|
|
+ this.data.splice(index, 1);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addRow() {
|
|
|
+ this.data.push({
|
|
|
+ quantity: 0
|
|
|
+ });
|
|
|
},
|
|
|
- dicChange(name, row) {
|
|
|
- if (name == "dot") {
|
|
|
+ rowDicChange(name, row, el) {
|
|
|
+ if (name == "reservoirAreaName") {
|
|
|
if (row) {
|
|
|
- this.query.inventory = row.balanceQuantity;
|
|
|
- this.onLoad();
|
|
|
+ el.reservoirAreaId = row.id;
|
|
|
+ el.balanceQuantity = row.balanceQuantity;
|
|
|
} else {
|
|
|
- this.query.dot = null;
|
|
|
+ el.reservoirAreaId = null;
|
|
|
+ el.reservoirAreaName = null;
|
|
|
+ el.balanceQuantity = null;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
qtyChange(row) {
|
|
|
+ row.quantity = row.quantityFinancing;
|
|
|
+ row.quantityHave = 0;
|
|
|
let sum = 0;
|
|
|
for (let item of this.data) {
|
|
|
sum += Number(item.quantity);
|
|
|
@@ -159,22 +190,16 @@ export default {
|
|
|
return this.$message.error("总数量不能超过" + this.qtyMax);
|
|
|
}
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- let obj = {
|
|
|
- shipId: this.form.id,
|
|
|
- shipItemId: this.query.id,
|
|
|
- goodsId: this.query.goodsId,
|
|
|
- storageId: this.form.storageId,
|
|
|
- dot: this.query.dot
|
|
|
- };
|
|
|
- this.loading = true;
|
|
|
- selectReservoirAreaList(obj)
|
|
|
- .then(res => {
|
|
|
- this.data = res.data.data;
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ qtyChange2(row) {
|
|
|
+ row.quantity = row.quantityHave;
|
|
|
+ row.quantityFinancing = 0;
|
|
|
+ let sum = 0;
|
|
|
+ for (let item of this.data) {
|
|
|
+ sum += Number(item.quantity);
|
|
|
+ }
|
|
|
+ if (sum > this.qtyMax) {
|
|
|
+ return this.$message.error("总数量不能超过" + this.qtyMax);
|
|
|
+ }
|
|
|
},
|
|
|
openDialog(form, row, index) {
|
|
|
this.form = {};
|
|
|
@@ -185,17 +210,24 @@ export default {
|
|
|
this.form = form;
|
|
|
this.query = row;
|
|
|
this.index = index;
|
|
|
- this.data = this.deepClone(row.historyList);
|
|
|
- this.qtyMax = row.inventory;
|
|
|
- this.callInStorageId = form.callInStorageId;
|
|
|
+ this.data = this.deepClone(row.historyList);
|
|
|
+ this.qtyMax = row.remainingNum;
|
|
|
this.dialogVisible = true;
|
|
|
- if (row.historyList.length == 0) {
|
|
|
- this.onLoad();
|
|
|
- }
|
|
|
},
|
|
|
submit() {
|
|
|
- if (this.data.filter(item => item.quantity > 0).length == 0) {
|
|
|
- return this.$message.error("至少有一条本次数量不能为0");
|
|
|
+ let sum = 0;
|
|
|
+ let sendNumFinancing=0;
|
|
|
+ let sendNumHave=0;
|
|
|
+ for (let item of this.data) {
|
|
|
+ if (!item.reservoirAreaId) {
|
|
|
+ return this.$message.error("请选择库区");
|
|
|
+ }
|
|
|
+ if (!item.quantity) {
|
|
|
+ return this.$message.error("本次数量不能为0");
|
|
|
+ }
|
|
|
+ sum += Number(item.quantity);
|
|
|
+ sendNumFinancing+= Number(item.sendNumFinancing);
|
|
|
+ sendNumHave+= Number(item.sendNumHave);
|
|
|
}
|
|
|
for (let item of this.data.filter(item => item.quantity > 0)) {
|
|
|
if (this.data.filter(item => item.quantity > 0)[0].dot != item.dot) {
|
|
|
@@ -205,22 +237,18 @@ export default {
|
|
|
if (!this.query.dot) {
|
|
|
this.query.dot = this.data.filter(item => item.quantity > 0)[0].dot;
|
|
|
}
|
|
|
- let sum = 0;
|
|
|
- for (let item of this.data) {
|
|
|
- sum += Number(item.quantity);
|
|
|
- }
|
|
|
- for (let item of this.data.filter(item => item.quantity > 0)) {
|
|
|
- if (!item.callInReservoirAreaId) {
|
|
|
- return this.$message.error("请选择调入库区");
|
|
|
- }
|
|
|
- }
|
|
|
if (sum > this.qtyMax) {
|
|
|
return this.$message.error("总数量不能超过" + this.qtyMax);
|
|
|
}
|
|
|
+ if (Number(sum) != Number(this.qtyMax)) {
|
|
|
+ return this.$message.error("本次数量合计必须达到:" + this.qtyMax);
|
|
|
+ }
|
|
|
let obj = {
|
|
|
...this.query,
|
|
|
sendNum: sum,
|
|
|
- historyList: this.data.filter(item => item.quantity > 0)
|
|
|
+ sendNumFinancing:sendNumFinancing,
|
|
|
+ sendNumHave:sendNumHave,
|
|
|
+ historyList: this.data
|
|
|
};
|
|
|
this.$emit("areaData", obj, this.index);
|
|
|
|