|
@@ -13,38 +13,41 @@
|
|
|
<van-field v-model="formData.businessTypeName" readonly :label="$t('waitInbound.dataSource')" />
|
|
|
<van-field v-model="formData.businessCode" readonly label="入库单号" />
|
|
|
<van-field v-model="formData.code" readonly label="物流信息" />
|
|
|
- <div style="padding:0 16px;">
|
|
|
- <van-button type="primary" round block @click="openSelectGood()">选择物品</van-button>
|
|
|
- </div>
|
|
|
+
|
|
|
<!-- <van-popup v-model:show="typeModal" round position="bottom">
|
|
|
<van-picker :columns="columns" @cancel="typeModal = false" @confirm="onConfirm" />
|
|
|
</van-popup> -->
|
|
|
</van-cell-group>
|
|
|
<!-- overflow-x: auto;width:calc(100% - 20px) -->
|
|
|
+ <div style="padding:0 5px;margin:5px 0">
|
|
|
+ <van-button type="primary" round block @click="openSelectGood()" style="height:30px">选择物品</van-button>
|
|
|
+ </div>
|
|
|
<van-cell-group inset style="padding:10px;">
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th style="width:300px">物品信息</th>
|
|
|
+ <th style="width:60%;text-align: left">物品信息</th>
|
|
|
<!-- <th style="min-width:60px">采购数量</th>
|
|
|
<th style="min-width:60px">本次发货</th>
|
|
|
<th style="min-width:45px">已入库</th> -->
|
|
|
- <th style="min-width:85px">本次登记累计</th>
|
|
|
+ <th style="width:25%">本次登记累计</th>
|
|
|
+ <th style="width:15%">操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
</table>
|
|
|
- <div style="height:calc(100vh - 495px);overflow-y:auto">
|
|
|
+ <!-- style="height:calc(100vh - 495px);overflow-y:auto" -->
|
|
|
+ <div>
|
|
|
<table class="table">
|
|
|
<tbody>
|
|
|
- <template v-for="(row,index) in formData.stockWaitDetailsList" :key="row.id">
|
|
|
+ <template v-for="(row,index) in formData.productList" :key="row.id">
|
|
|
<div style="height:10px">
|
|
|
|
|
|
</div>
|
|
|
<tr>
|
|
|
- <td style="text-align:left;width:300px">
|
|
|
+ <td style="text-align:left;width:60%">
|
|
|
<div>编码:{{row.productCode}}</div>
|
|
|
- <div>名称:{{row.productName}}</div>
|
|
|
- <div>规格:{{row.productSpec}}</div>
|
|
|
+ <div style="margin-top:3px">名称:{{row.productName}}</div>
|
|
|
+ <div style="margin-top:3px">规格:{{row.productSpec}}</div>
|
|
|
</td>
|
|
|
<!-- <td style="min-width:60px">
|
|
|
<div>{{row.purchaseQuantity}}</div>
|
|
@@ -55,14 +58,17 @@
|
|
|
<td style="min-width:45px">
|
|
|
<div>{{row.receiptQuantity}}</div>
|
|
|
</td> -->
|
|
|
- <td style="min-width:85px">
|
|
|
- <div style="color:red">{{row.quantity}}</div>
|
|
|
+ <td style="width:25%">
|
|
|
+ <div style="color:red;">{{row.quantity}}</div>
|
|
|
+ </td>
|
|
|
+ <td style="width:15%">
|
|
|
+ <span style="color:#409EFF;cursor:pointer" @click="handleDeleteRow(row,index)">删除</span>
|
|
|
</td>
|
|
|
</tr>
|
|
|
- <tr style="border-bottom:1px solid #dbd4d4;">
|
|
|
+ <tr style="border-bottom:1px solid #f1f1f1;">
|
|
|
<td colspan="5" style="padding:0 6px">
|
|
|
<div style="text-align:center;color:#b7b0b0;margin-bottom:10px" @click="row.isArrow =!row.isArrow">
|
|
|
- <span>在线登记登记</span>
|
|
|
+ <span>在线登记</span>
|
|
|
<van-icon :name="!row.isArrow ?'arrow-down':'arrow-up'" style="margin-left:5px" />
|
|
|
</div>
|
|
|
<div v-show="row.isArrow" style="margin-top:5px;margin-bottom:10px">
|
|
@@ -76,13 +82,12 @@
|
|
|
<tr>
|
|
|
<th>时间</th>
|
|
|
<th style="width:70px">登记数量</th>
|
|
|
- <th style="width:70px">提交状态</th>
|
|
|
<th style="width:50px">操作</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
|
|
|
|
- <tr v-for="(sonRow,sonIndex) in row.stockWaitDetailsCheckList" :key="sonIndex">
|
|
|
+ <tr v-for="(sonRow,sonIndex) in row.excessGoodsRegisterList" :key="sonIndex">
|
|
|
<td>
|
|
|
{{sonRow.createTime}}
|
|
|
</td>
|
|
@@ -90,9 +95,6 @@
|
|
|
{{sonRow.quantity}}
|
|
|
</td>
|
|
|
<td>
|
|
|
- {{sonRow.status==2?'已提交':'未提交'}}
|
|
|
- </td>
|
|
|
- <td>
|
|
|
<span style="color:#409EFF;cursor:pointer" v-if="sonRow.status !=2" @click="handleDelete(row,index,sonRow)">删除</span>
|
|
|
</td>
|
|
|
</tr>
|
|
@@ -109,8 +111,8 @@
|
|
|
|
|
|
</van-cell-group>
|
|
|
|
|
|
- <div style="margin: 10px">
|
|
|
- <van-button round block type="primary" native-type="submit">
|
|
|
+ <div style="margin: 5px">
|
|
|
+ <van-button round block type="primary" native-type="submit" style="height:30px">
|
|
|
{{$t('common.submit')}}
|
|
|
</van-button>
|
|
|
</div>
|
|
@@ -126,22 +128,13 @@ import { useRoute } from "vue-router";
|
|
|
import { parseTime } from "@/utils/ruoyi";
|
|
|
import useSelectGoodStore from "@/store/manyGood";
|
|
|
const selectGoodStore = useSelectGoodStore();
|
|
|
+import $bus from "@/bus/index.js";
|
|
|
+
|
|
|
const proxy = getCurrentInstance().proxy;
|
|
|
const active = ref(0);
|
|
|
const route = useRoute();
|
|
|
const typeModal = ref(false);
|
|
|
const formData = ref({});
|
|
|
-const list = computed(() =>
|
|
|
- selectGoodStore.selectGood.map((x) => ({ ...x, quantity: 0 }))
|
|
|
-);
|
|
|
-watch(
|
|
|
- () => list.value,
|
|
|
- (val) => {
|
|
|
- console.log(list.value, "sasaw");
|
|
|
-
|
|
|
- formData.value.stockWaitDetailsList = list.value;
|
|
|
- }
|
|
|
-);
|
|
|
const getDict = () => {
|
|
|
proxy.post("/warehouse/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
|
|
|
columns.value = res.data.rows.map((item) => {
|
|
@@ -171,16 +164,19 @@ const onConfirm = ({ selectedOptions }) => {
|
|
|
const onClickLeft = () => history.back();
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
- const list = formData.value.stockWaitDetailsList;
|
|
|
+ const list = formData.value.productList;
|
|
|
+ if (!(list && list.length > 0)) {
|
|
|
+ return showFailToast("请选择物品");
|
|
|
+ }
|
|
|
const total = list.reduce((total, x) => (total += Number(x.quantity)), 0);
|
|
|
if (!(total > 0)) {
|
|
|
return showFailToast("登记累计不能为0");
|
|
|
}
|
|
|
- proxy.post("/stockWait/addByWdly", formData.value).then(
|
|
|
+ proxy.post("/excessGoodsInfo/add", { stockWaitId: formData.value.id }).then(
|
|
|
(res) => {
|
|
|
+ showSuccessToast("操作成功");
|
|
|
setTimeout(() => {
|
|
|
- showSuccessToast(proxy.$t("manualInbound.warehousingSuccess"));
|
|
|
- proxy.$router.push("/main/waitInbound");
|
|
|
+ onClickLeft();
|
|
|
}, 500);
|
|
|
},
|
|
|
(err) => {
|
|
@@ -199,23 +195,58 @@ const businessType = ref([
|
|
|
{ label: "退货出库", value: "4" },
|
|
|
]);
|
|
|
|
|
|
+const getProductList = () => {
|
|
|
+ proxy.post("/excessGoodsDetails/list", { stockWaitId: route.query.id }).then(
|
|
|
+ (res) => {
|
|
|
+ if (res && res.data && res.data.length > 0) {
|
|
|
+ formData.value.productList = res.data.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ productCode: x.productCustomCode,
|
|
|
+ quantity: x.excessGoodsRegisterList
|
|
|
+ ? x.excessGoodsRegisterList.reduce(
|
|
|
+ (total, y) => (total += Number(y.quantity)),
|
|
|
+ 0
|
|
|
+ )
|
|
|
+ : 0,
|
|
|
+ }));
|
|
|
+ selectGoodStore.setGood(formData.value.productList);
|
|
|
+ } else {
|
|
|
+ formData.value.productList = [];
|
|
|
+ selectGoodStore.clearGood();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
onMounted(() => {
|
|
|
selectGoodStore.clearGood();
|
|
|
+ // $bus.on("selectGood", (row) => {
|
|
|
+ // formData.value.productList.push({
|
|
|
+ // productId: row.id,
|
|
|
+ // productCode: row.customCode,
|
|
|
+ // productName: row.name,
|
|
|
+ // productSpec: row.spec,
|
|
|
+ // });
|
|
|
+ // });
|
|
|
if (route.query && route.query.id) {
|
|
|
formData.value = {
|
|
|
...route.query,
|
|
|
+ productList: [],
|
|
|
};
|
|
|
+ getProductList();
|
|
|
}
|
|
|
// getDict();
|
|
|
});
|
|
|
|
|
|
const getSonList = (query, index) => {
|
|
|
- proxy.post("/stockWaitDetailsCheck/list", query).then((res) => {
|
|
|
- formData.value.stockWaitDetailsList[index].stockWaitDetailsCheckList =
|
|
|
- res.data;
|
|
|
- formData.value.stockWaitDetailsList[index].quantity = res.data
|
|
|
- .filter((x) => x.status != 2)
|
|
|
- .reduce((total, y) => (total += Number(y.quantity)), 0);
|
|
|
+ proxy.post("/excessGoodsRegister/list", query).then((res) => {
|
|
|
+ formData.value.productList[index].excessGoodsRegisterList = res.data;
|
|
|
+ formData.value.productList[index].quantity = res.data.reduce(
|
|
|
+ (total, y) => (total += Number(y.quantity)),
|
|
|
+ 0
|
|
|
+ );
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -223,16 +254,14 @@ const handleStag = (row, index) => {
|
|
|
if (Number(row.addQuantity) > 0) {
|
|
|
let obj = {
|
|
|
stockWaitId: formData.value.id,
|
|
|
- stockWaitDetailsId: row.id,
|
|
|
+ excessGoodsDetailsId: row.id,
|
|
|
createTime: parseTime(new Date()),
|
|
|
quantity: Number(row.addQuantity),
|
|
|
- status: 0,
|
|
|
};
|
|
|
- // row.stockWaitDetailsCheckList.push(obj);
|
|
|
-
|
|
|
- proxy.post("/stockWaitDetailsCheck/add", obj).then((res) => {
|
|
|
+ proxy.post("/excessGoodsRegister/add", obj).then((res) => {
|
|
|
row.addQuantity = "";
|
|
|
- getSonList({ stockWaitDetailsId: row.id }, index);
|
|
|
+ // getSonList({ stockWaitId: formData.value.id }, index);
|
|
|
+ getProductList();
|
|
|
return showSuccessToast("暂存成功");
|
|
|
});
|
|
|
} else {
|
|
@@ -240,13 +269,23 @@ const handleStag = (row, index) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-const handleDelete = (row, index, sonRow) => {
|
|
|
- // formData.value.stockWaitDetailsList[index].stockWaitDetailsCheckList.splice(
|
|
|
- // sonIndex,
|
|
|
- // 1
|
|
|
+const handleDeleteRow = (row, index) => {
|
|
|
+ // let currentIndex = selectGoodStore.selectGood.findIndex(
|
|
|
+ // (x) => x.productId == row.productId
|
|
|
// );
|
|
|
- proxy.post("/stockWaitDetailsCheck/delete", { id: sonRow.id }).then((res) => {
|
|
|
- getSonList({ stockWaitDetailsId: row.id }, index);
|
|
|
+ // if (currentIndex != -1) {
|
|
|
+ // selectGoodStore.selectGood.splice(currentIndex, 1);
|
|
|
+ // }
|
|
|
+ proxy.post("/excessGoodsDetails/delete", { id: row.id }).then((res) => {
|
|
|
+ getProductList();
|
|
|
+ return showSuccessToast("删除成功");
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handleDelete = (row, index, sonRow) => {
|
|
|
+ proxy.post("/excessGoodsRegister/delete", { id: sonRow.id }).then((res) => {
|
|
|
+ // getSonList({ stockWaitId: formData.value.id }, index);
|
|
|
+ getProductList();
|
|
|
return showSuccessToast("删除成功");
|
|
|
});
|
|
|
};
|
|
@@ -254,10 +293,16 @@ const handleDelete = (row, index, sonRow) => {
|
|
|
const openSelectGood = () => {
|
|
|
proxy.$router.push({
|
|
|
path: "/main/selectGood",
|
|
|
+ query: {
|
|
|
+ stockWaitId: formData.value.id,
|
|
|
+ },
|
|
|
});
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
+* {
|
|
|
+ font-size: 11px;
|
|
|
+}
|
|
|
.row {
|
|
|
display: flex;
|
|
|
padding: 5px 10px 0 10px;
|
|
@@ -280,7 +325,7 @@ const openSelectGood = () => {
|
|
|
color: #606266;
|
|
|
thead tr th {
|
|
|
padding: 6px 2px;
|
|
|
- text-align: left;
|
|
|
+ text-align: center;
|
|
|
color: #000;
|
|
|
}
|
|
|
td {
|