|
@@ -47,6 +47,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
+ submitType: null,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -119,8 +120,15 @@ export default {
|
|
|
};
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
- handleTurn({ row }) {
|
|
|
- const arr = row.defectiveQuantity.split(".");
|
|
|
+ handleTurn({ row }, type) {
|
|
|
+ this.submitType = type;
|
|
|
+ let arr = [];
|
|
|
+ if (type == 1) {
|
|
|
+ arr = row.defectiveQuantity.split(".");
|
|
|
+ } else {
|
|
|
+ arr = row.quantity.split(".");
|
|
|
+ }
|
|
|
+
|
|
|
this.form = { id: row.stockId, canSum: arr[0], quantity: "" };
|
|
|
this.open = true;
|
|
|
},
|
|
@@ -128,14 +136,23 @@ export default {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (Number(this.form.quantity) > this.form.canSum) {
|
|
|
- return this.msgInfo("数量不可大于次品数量");
|
|
|
+ return this.msgInfo("数量不可大于可转数量");
|
|
|
+ }
|
|
|
+ if (this.submitType == 1) {
|
|
|
+ const data = { ...this.form };
|
|
|
+ API.badToGood(data).then((res) => {
|
|
|
+ this.msgSuccess("操作成功!");
|
|
|
+ this.getList();
|
|
|
+ this.open = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ const data = { ...this.form };
|
|
|
+ API.badToBad(data).then((res) => {
|
|
|
+ this.msgSuccess("操作成功!");
|
|
|
+ this.getList();
|
|
|
+ this.open = false;
|
|
|
+ });
|
|
|
}
|
|
|
- const data = { ...this.form };
|
|
|
- API.badToGood(data).then((res) => {
|
|
|
- this.msgSuccess("操作成功!");
|
|
|
- this.getList();
|
|
|
- this.open = false;
|
|
|
- });
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -187,14 +204,20 @@ export default {
|
|
|
align="left"
|
|
|
prop="defectiveQuantity"
|
|
|
/>
|
|
|
- <el-table-column label="操作" align="center" width="100">
|
|
|
+ <el-table-column label="操作" align="center" width="180">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
type="text"
|
|
|
v-if="scope.row.defectiveQuantity !== '0.00'"
|
|
|
- @click="handleTurn(scope)"
|
|
|
+ @click="handleTurn(scope, 1)"
|
|
|
>次品转良品</el-button
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ v-if="scope.row.quantity !== '0.00'"
|
|
|
+ @click="handleTurn(scope, 2)"
|
|
|
+ >良品转次品</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|