|
|
@@ -1,20 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-dialog title="查看库区" :visible.sync="dialogVisible" append-to-body width="60%" :before-close="handleClose" v-dialog-drag>
|
|
|
- <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>
|
|
|
- </div>
|
|
|
-
|
|
|
<avue-crud
|
|
|
v-if="dialogVisible"
|
|
|
:option="option"
|
|
|
@@ -24,9 +10,42 @@
|
|
|
id="out-table"
|
|
|
:header-cell-class-name="headerClassName"
|
|
|
>
|
|
|
+ <template slot-scope="{ scope, row }" slot="menuLeft">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <el-button type="primary" size="small" @click="addRow" :disabled="disabled">新增</el-button>
|
|
|
+ <dic-select
|
|
|
+ v-if="dialogVisible"
|
|
|
+ style="width: 300px;"
|
|
|
+ v-model="query.dot"
|
|
|
+ placeholder="批次号"
|
|
|
+ label="dot"
|
|
|
+ :disabled="disabled || query.historyList.length || query.whether != 1"
|
|
|
+ :url="'/blade-sales-part/stockDesc/dotList?storageId=' + form.storageId + '&goodsId=' + query.goodsId"
|
|
|
+ :filterable="true"
|
|
|
+ :allowCreate="true"
|
|
|
+ ></dic-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot="reservoirAreaName" slot-scope="{ row }">
|
|
|
+ <dic-select
|
|
|
+ v-model="row.reservoirAreaName"
|
|
|
+ placeholder="库区"
|
|
|
+ label="cname"
|
|
|
+ res="records"
|
|
|
+ :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + form.storageId"
|
|
|
+ :filterable="true"
|
|
|
+ :remote="true"
|
|
|
+ dataName="cname"
|
|
|
+ :disabled="disabled"
|
|
|
+ @selectChange="rowDicChange('reservoirAreaName', $event, row)"
|
|
|
+ ></dic-select>
|
|
|
+ </template>
|
|
|
<template slot="quantity" slot-scope="{ row }">
|
|
|
<el-input-number v-model="row.quantity" size="small" :controls="false" style="width: 100%" :disabled="disabled" />
|
|
|
</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>
|
|
|
@@ -37,10 +56,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: {
|
|
|
@@ -59,32 +76,21 @@ export default {
|
|
|
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",
|
|
|
- filters: true,
|
|
|
- sortable: true,
|
|
|
- overHidden: true
|
|
|
- },
|
|
|
- {
|
|
|
- label: "库存",
|
|
|
- prop: "balanceQuantity",
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
|
@@ -96,80 +102,98 @@ export default {
|
|
|
},
|
|
|
form: {},
|
|
|
query: {},
|
|
|
- index: 0,
|
|
|
- qtyMax: 0
|
|
|
+ index: 0
|
|
|
};
|
|
|
},
|
|
|
async created() {},
|
|
|
methods: {
|
|
|
- dicChange(name, row) {
|
|
|
- if (name == "dot") {
|
|
|
- if (row) {
|
|
|
- this.query.inventory = row.balanceQuantity;
|
|
|
- this.onLoad();
|
|
|
+ rowDel(row, index) {
|
|
|
+ this.$confirm("确定删除数据?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ if (row.id) {
|
|
|
+ itemRemove({ ids: row.id }).then(res => {
|
|
|
+ this.data.splice(index, 1);
|
|
|
+ let sum = 0;
|
|
|
+ for (let item of this.data) {
|
|
|
+ sum += Number(item.quantity);
|
|
|
+ }
|
|
|
+ let obj = {
|
|
|
+ ...this.query,
|
|
|
+ sendNum: sum,
|
|
|
+ historyList: this.data
|
|
|
+ };
|
|
|
+ this.$emit("areaData", obj, this.index);
|
|
|
+ this.$message.success("操作成功!");
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.query.dot = null;
|
|
|
- this.onLoad();
|
|
|
+ this.data.splice(index, 1);
|
|
|
+ if (this.query.historyList.length) {
|
|
|
+ let sum = 0;
|
|
|
+ for (let item of this.data) {
|
|
|
+ sum += Number(item.quantity);
|
|
|
+ }
|
|
|
+ let obj = {
|
|
|
+ ...this.query,
|
|
|
+ sendNum: sum,
|
|
|
+ historyList: this.data
|
|
|
+ };
|
|
|
+ this.$emit("areaData", obj, this.index);
|
|
|
+ }
|
|
|
+ this.$message.success("操作成功!");
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addRow() {
|
|
|
+ if (!this.query.dot && this.query.whether == 1) {
|
|
|
+ return this.$message.error("请选择批次号!");
|
|
|
}
|
|
|
+ this.data.push({
|
|
|
+ quantity: 0
|
|
|
+ });
|
|
|
},
|
|
|
- onLoad() {
|
|
|
- let obj = {
|
|
|
- shipId: this.form.id,
|
|
|
- shipItemId: this.query.id,
|
|
|
- goodsId: this.query.goodsId,
|
|
|
- storageId: this.form.storageId,
|
|
|
- dot: this.query.dot,
|
|
|
- whether: 1
|
|
|
- };
|
|
|
- this.loading = true;
|
|
|
- selectReservoirAreaList(obj)
|
|
|
- .then(res => {
|
|
|
- this.data = res.data.data;
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ rowDicChange(name, row, el) {
|
|
|
+ if (name == "reservoirAreaName") {
|
|
|
+ if (row) {
|
|
|
+ el.reservoirAreaId = row.id;
|
|
|
+ el.balanceQuantity = row.balanceQuantity;
|
|
|
+ } else {
|
|
|
+ el.reservoirAreaId = null;
|
|
|
+ el.reservoirAreaName = null;
|
|
|
+ el.balanceQuantity = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
openDialog(form, row, index) {
|
|
|
this.form = {};
|
|
|
this.query = {};
|
|
|
this.index = null;
|
|
|
this.data = [];
|
|
|
- this.qtyMax = 0;
|
|
|
this.form = form;
|
|
|
this.query = row;
|
|
|
this.index = index;
|
|
|
this.data = this.deepClone(row.historyList);
|
|
|
- this.qtyMax = row.goodsNum;
|
|
|
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");
|
|
|
- }
|
|
|
- for (let item of this.data.filter(item => item.quantity > 0)) {
|
|
|
- if (this.data.filter(item => item.quantity > 0)[0].dot != item.dot) {
|
|
|
- return this.$message.error("请选择一种批次号");
|
|
|
- }
|
|
|
- }
|
|
|
- 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.filter(item => item.quantity > 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);
|
|
|
}
|
|
|
let obj = {
|
|
|
...this.query,
|
|
|
sendNum: sum,
|
|
|
- historyList: this.data.filter(item => item.quantity > 0)
|
|
|
+ historyList: this.data
|
|
|
};
|
|
|
this.$emit("areaData", obj, this.index);
|
|
|
-
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
//自定义列保存
|