|
@@ -42,7 +42,9 @@
|
|
|
<div style="width: 100%">
|
|
|
<el-table
|
|
|
:data="
|
|
|
- modalType === 'add' ? formData.data.deliverGoodsDetailsList : []
|
|
|
+ modalType === 'add'
|
|
|
+ ? formData.data.deliverGoodsDetailsList
|
|
|
+ : formData.data.arrivalDetailList
|
|
|
"
|
|
|
>
|
|
|
<el-table-column
|
|
@@ -86,31 +88,15 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="sumArrivalCount"
|
|
|
+ prop="transitQuantity"
|
|
|
label="剩余在途"
|
|
|
v-if="modalType === 'edit'"
|
|
|
/>
|
|
|
<el-table-column
|
|
|
- prop="count"
|
|
|
+ prop="deliverGoodsQuantity"
|
|
|
label="本次到货"
|
|
|
- min-width="150"
|
|
|
v-if="modalType === 'edit'"
|
|
|
- >
|
|
|
- <template #default="{ row, $index }">
|
|
|
- <el-form-item
|
|
|
- :prop="'arrivalDetailList.' + $index + '.count'"
|
|
|
- :rules="rules.count"
|
|
|
- :inline-message="true"
|
|
|
- >
|
|
|
- <el-input-number
|
|
|
- v-model="row.count"
|
|
|
- :precision="4"
|
|
|
- :controls="false"
|
|
|
- :min="0"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ />
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -135,6 +121,7 @@
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
+import { watch } from "vue";
|
|
|
|
|
|
const loading = ref(false);
|
|
|
const submitLoading = ref(false);
|
|
@@ -149,6 +136,9 @@ const sourceList = ref({
|
|
|
let dialogVisible = ref(false);
|
|
|
let modalType = ref("add");
|
|
|
let rules = ref({
|
|
|
+ deliverGoodsId: [
|
|
|
+ { required: true, message: "请选择快递单号", trigger: "change" },
|
|
|
+ ],
|
|
|
logisticsCompanyCode: [
|
|
|
{ required: true, message: "请选择物流公司", trigger: "change" },
|
|
|
],
|
|
@@ -378,14 +368,14 @@ const configData = [
|
|
|
[
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "supplyName",
|
|
|
label: "供应商",
|
|
|
disabled: true,
|
|
|
itemWidth: 50,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
- prop: "name",
|
|
|
+ prop: "purchaseCode",
|
|
|
label: "采购单号",
|
|
|
disabled: true,
|
|
|
itemWidth: 50,
|
|
@@ -393,7 +383,7 @@ const configData = [
|
|
|
{
|
|
|
type: "select",
|
|
|
label: "物流/快递单号",
|
|
|
- prop: "name",
|
|
|
+ prop: "deliverGoodsId",
|
|
|
itemWidth: 50,
|
|
|
style: {
|
|
|
width: "100%",
|
|
@@ -407,6 +397,7 @@ const configData = [
|
|
|
],
|
|
|
];
|
|
|
|
|
|
+const deliverData = ref([]);
|
|
|
const getList = async (req) => {
|
|
|
sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
loading.value = true;
|
|
@@ -422,6 +413,7 @@ const getList = async (req) => {
|
|
|
|
|
|
const submitForm = () => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
+ loading.value = true;
|
|
|
if (modalType.value === "add") {
|
|
|
const list = formData.data.deliverGoodsDetailsList;
|
|
|
const total = list.reduce(
|
|
@@ -457,15 +449,31 @@ const submitForm = () => {
|
|
|
type: "success",
|
|
|
});
|
|
|
dialogVisible.value = false;
|
|
|
+ loading.value = false;
|
|
|
getList();
|
|
|
});
|
|
|
} else if (modalType.value === "edit") {
|
|
|
- proxy.post("/arrival/add", formData.data).then((res) => {
|
|
|
+ formData.data.arrivalDetailList = formData.data.arrivalDetailList.map(
|
|
|
+ (x) => ({
|
|
|
+ bussinessId: x.bussinessId,
|
|
|
+ purchaseDetailId: x.purchaseDetailId,
|
|
|
+ deliverGoodsDetailsId: x.deliverGoodsDetailsId,
|
|
|
+ count: x.deliverGoodsQuantity,
|
|
|
+ })
|
|
|
+ );
|
|
|
+ const victoriatouristJson = {
|
|
|
+ deliverGoodsId: formData.data.deliverGoodsId,
|
|
|
+ logisticsCompanyCode: formData.data.logisticsCompanyCode,
|
|
|
+ code: formData.data.code,
|
|
|
+ };
|
|
|
+ formData.victoriatouristJson = JSON.stringify(victoriatouristJson);
|
|
|
+ proxy.post("/arrival/addByWdly", formData.data).then((res) => {
|
|
|
ElMessage({
|
|
|
message: `操作成功!`,
|
|
|
type: "success",
|
|
|
});
|
|
|
dialogVisible.value = false;
|
|
|
+ loading.value = false;
|
|
|
getList();
|
|
|
});
|
|
|
}
|
|
@@ -494,17 +502,13 @@ const handleEdit = (row, status) => {
|
|
|
}
|
|
|
).then(() => {
|
|
|
// 删除
|
|
|
- proxy
|
|
|
- .post("/purchase/edit", {
|
|
|
- data,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- ElMessage({
|
|
|
- message: `${purchaseStatusName}成功`,
|
|
|
- type: "success",
|
|
|
- });
|
|
|
- getList();
|
|
|
+ proxy.post("/purchase/edit", data).then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: `${purchaseStatusName}成功`,
|
|
|
+ type: "success",
|
|
|
});
|
|
|
+ getList();
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -553,27 +557,56 @@ const handleArrival = (row, type) => {
|
|
|
} else if (type === "edit") {
|
|
|
formConfig = configData[1];
|
|
|
proxy.post("/deliverGoods/list", { id: row.id }).then((res) => {
|
|
|
- console.log(res, "wss");
|
|
|
- });
|
|
|
- proxy.post("/deliverGoods/detail", { id: row.id }).then((res) => {
|
|
|
- console.log(res, "wss");
|
|
|
+ deliverData.value = res;
|
|
|
+ formConfig[2].data = res.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.code,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
formData.data = {
|
|
|
purchaseId: row.id,
|
|
|
- code: res.code,
|
|
|
- supplyId: res.supplyId,
|
|
|
- arrivalDetailList: res.purchaseDetailList.map((x) => ({
|
|
|
- ...x,
|
|
|
- purchaseDetailId: x.id,
|
|
|
- purchaseCount: x.count,
|
|
|
- count: 0,
|
|
|
- })),
|
|
|
- arrivalStatus: "",
|
|
|
+ supplyName: row.supplyName,
|
|
|
+ purchaseCode: row.code,
|
|
|
+ supplyId: row.supplyId,
|
|
|
+ code: "",
|
|
|
+ logisticsCompanyCode: "",
|
|
|
+ deliverGoodsId: "",
|
|
|
+ arrivalDetailList: [],
|
|
|
};
|
|
|
dialogVisible.value = true;
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+watch(
|
|
|
+ () => formData.data.deliverGoodsId,
|
|
|
+ (val) => {
|
|
|
+ if (val) {
|
|
|
+ const current = deliverData.value.find((x) => x.id === val);
|
|
|
+ formData.data.logisticsCompanyCode = current
|
|
|
+ ? current.logisticsCompanyCode
|
|
|
+ : "";
|
|
|
+ formData.data.code = current ? current.code : "";
|
|
|
+ // formData.data.logisticsCompanyName = current ? current.logisticsCompanyCode : "";
|
|
|
+ proxy.post("/deliverGoods/detail", { id: val }).then((res) => {
|
|
|
+ formData.data.arrivalDetailList = res.map((x) => ({
|
|
|
+ count: x.count,
|
|
|
+ productName: x.name,
|
|
|
+ productSpec: x.spec,
|
|
|
+ productUnit: x.unit,
|
|
|
+ productType: x.type,
|
|
|
+ productCode: x.code,
|
|
|
+ bussinessId: x.id,
|
|
|
+ purchaseDetailId: x.purchaseDetailId,
|
|
|
+ deliverGoodsDetailsId: x.deliverGoodsId,
|
|
|
+ transitQuantity: x.transitQuantity,
|
|
|
+ deliverGoodsQuantity: x.deliverGoodsQuantity,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
getList();
|
|
|
getLogisticsData();
|
|
|
</script>
|