|
@@ -8,6 +8,7 @@ import byTable from "@/components/by-table/index.js";
|
|
import addPurchase from "./addPurchase.vue";
|
|
import addPurchase from "./addPurchase.vue";
|
|
|
|
|
|
import * as API from "@/api/purchase-management/purchase/index.js";
|
|
import * as API from "@/api/purchase-management/purchase/index.js";
|
|
|
|
+import { supplySelect } from "@/api/product-material/supply/index.js";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
@@ -18,6 +19,10 @@ export default {
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ purchaseStatusList: [],
|
|
|
|
+ productTypeList: [],
|
|
|
|
+ supplySelectList: [],
|
|
|
|
+ supplyTypeList: [],
|
|
btnForm: {
|
|
btnForm: {
|
|
otherButton: {
|
|
otherButton: {
|
|
list: [
|
|
list: [
|
|
@@ -26,7 +31,7 @@ export default {
|
|
methodsText: "add",
|
|
methodsText: "add",
|
|
type: "primary",
|
|
type: "primary",
|
|
add: () => {
|
|
add: () => {
|
|
- this.handleAdd();
|
|
|
|
|
|
+ this.handlePurchases();
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -76,28 +81,44 @@ export default {
|
|
cause: "",
|
|
cause: "",
|
|
goodsId: [],
|
|
goodsId: [],
|
|
},
|
|
},
|
|
|
|
+ selectData: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
const businessDictData = JSON.parse(
|
|
const businessDictData = JSON.parse(
|
|
window.localStorage.getItem("businessDict")
|
|
window.localStorage.getItem("businessDict")
|
|
);
|
|
);
|
|
- const list = businessDictData.find(
|
|
|
|
|
|
+
|
|
|
|
+ this.productTypeList = businessDictData.find(
|
|
(item) => item.code === "productType"
|
|
(item) => item.code === "productType"
|
|
).children;
|
|
).children;
|
|
- this.selectConfig[0].data = list.map((item) => ({
|
|
|
|
|
|
+ this.selectConfig[1].data = this.productTypeList.map((item) => ({
|
|
label: item.dictValue,
|
|
label: item.dictValue,
|
|
value: item.dictKey,
|
|
value: item.dictKey,
|
|
}));
|
|
}));
|
|
- this.productTypeList = list;
|
|
|
|
- // this.getList();
|
|
|
|
|
|
+
|
|
|
|
+ this.purchaseStatusList = businessDictData.find(
|
|
|
|
+ (item) => item.code === "purchaseStatus"
|
|
|
|
+ ).children;
|
|
|
|
+ this.selectConfig[0].data = this.purchaseStatusList.map((item) => ({
|
|
|
|
+ label: item.dictValue,
|
|
|
|
+ value: item.dictKey,
|
|
|
|
+ }));
|
|
|
|
+
|
|
|
|
+ this.supplyTypeList = businessDictData.find(
|
|
|
|
+ (item) => item.code === "supplyType"
|
|
|
|
+ ).children;
|
|
|
|
+
|
|
|
|
+ supplySelect({ name: "", code: "", type: "" }).then((res) => {
|
|
|
|
+ this.supplySelectList = res.data.data;
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
getList() {
|
|
getList() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
API.purchaseList(this.queryParams).then(
|
|
API.purchaseList(this.queryParams).then(
|
|
(res) => {
|
|
(res) => {
|
|
- console.log(res, "qq");
|
|
|
|
this.tableList = res.data.data.records;
|
|
this.tableList = res.data.data.records;
|
|
this.total = res.data.data.total;
|
|
this.total = res.data.data.total;
|
|
this.loading = false;
|
|
this.loading = false;
|
|
@@ -111,13 +132,33 @@ export default {
|
|
handleQuery() {
|
|
handleQuery() {
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
- handleAdd() {
|
|
|
|
|
|
+ handleSelectionChange(arr) {
|
|
|
|
+ this.selectData = arr;
|
|
|
|
+ },
|
|
|
|
+ handlePurchase(row) {
|
|
|
|
+ const goodsList = [{ ...row, unitPrice: "" }];
|
|
this.form = {
|
|
this.form = {
|
|
|
|
+ flowId: "",
|
|
|
|
+ flowRemark: "",
|
|
id: "",
|
|
id: "",
|
|
- receiptWarehouseId: "",
|
|
|
|
- planArrivalTime: "",
|
|
|
|
- cause: "",
|
|
|
|
- goodsId: [],
|
|
|
|
|
|
+ code: "",
|
|
|
|
+ supplieId: "",
|
|
|
|
+ goodsList: goodsList,
|
|
|
|
+ };
|
|
|
|
+ this.titleText = "add";
|
|
|
|
+ this.open = true;
|
|
|
|
+ },
|
|
|
|
+ handlePurchases() {
|
|
|
|
+ if (!this.selectData.length > 0)
|
|
|
|
+ return this.msgInfo("请先选择要采购的数据");
|
|
|
|
+ const goodsList = this.selectData.map((x) => ({ ...x, unitPrice: "" }));
|
|
|
|
+ this.form = {
|
|
|
|
+ flowId: "",
|
|
|
|
+ flowRemark: "",
|
|
|
|
+ id: "",
|
|
|
|
+ code: "",
|
|
|
|
+ supplieId: "",
|
|
|
|
+ goodsList: goodsList,
|
|
};
|
|
};
|
|
this.titleText = "add";
|
|
this.titleText = "add";
|
|
this.open = true;
|
|
this.open = true;
|
|
@@ -140,24 +181,28 @@ export default {
|
|
this.form.fileInfoList = [];
|
|
this.form.fileInfoList = [];
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.$refs.addCustomer.loading = true;
|
|
|
|
- this.$refs.addCustomer.countryChange(this.form.countryId);
|
|
|
|
- this.$refs.addCustomer.provinceChange(this.form.provinceId);
|
|
|
|
- this.$refs.addCustomer.loading = false;
|
|
|
|
|
|
+ this.$refs.sendSubscribe.loading = true;
|
|
|
|
+ this.$refs.sendSubscribe.loading = false;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
handleSubmit() {
|
|
handleSubmit() {
|
|
|
|
+ const goodsList = this.form.goodsList.map((x) => ({
|
|
|
|
+ id: x.id,
|
|
|
|
+ unitPrice: x.unitPrice,
|
|
|
|
+ quantity: x.quantity,
|
|
|
|
+ }));
|
|
|
|
+ this.form.goodsList = goodsList;
|
|
if (!this.form.id) {
|
|
if (!this.form.id) {
|
|
- API.purchaseAdd(this.form).then(
|
|
|
|
|
|
+ API.sendPurchase(this.form).then(
|
|
() => {
|
|
() => {
|
|
this.msgSuccess(this.$t("addSuccess"));
|
|
this.msgSuccess(this.$t("addSuccess"));
|
|
- this.$refs.addCustomer.loading = false;
|
|
|
|
|
|
+ this.$refs.sendSubscribe.loading = false;
|
|
this.open = false;
|
|
this.open = false;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
(err) => {
|
|
(err) => {
|
|
- console.log("purchaseAdd: " + err);
|
|
|
|
- this.$refs.addCustomer.loading = false;
|
|
|
|
|
|
+ console.log("sendPurchase: " + err);
|
|
|
|
+ this.$refs.sendSubscribe.loading = false;
|
|
}
|
|
}
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
@@ -165,12 +210,12 @@ export default {
|
|
() => {
|
|
() => {
|
|
this.msgSuccess(this.$t("editSuccess"));
|
|
this.msgSuccess(this.$t("editSuccess"));
|
|
this.open = false;
|
|
this.open = false;
|
|
- this.$refs.addCustomer.loading = false;
|
|
|
|
|
|
+ this.$refs.sendSubscribe.loading = false;
|
|
this.getList();
|
|
this.getList();
|
|
},
|
|
},
|
|
(err) => {
|
|
(err) => {
|
|
console.log("purchaseEdit: " + err);
|
|
console.log("purchaseEdit: " + err);
|
|
- this.$refs.addCustomer.loading = false;
|
|
|
|
|
|
+ this.$refs.sendSubscribe.loading = false;
|
|
}
|
|
}
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -188,6 +233,13 @@ export default {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ isSelectable(row) {
|
|
|
|
+ if (row.status != 10) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
showAddress(row) {
|
|
showAddress(row) {
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
@@ -217,41 +269,48 @@ export default {
|
|
}
|
|
}
|
|
"
|
|
"
|
|
></query>
|
|
></query>
|
|
- <el-table :data="tableList" v-loading="loading">
|
|
|
|
|
|
+ <el-table
|
|
|
|
+ :data="tableList"
|
|
|
|
+ v-loading="loading"
|
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column type="selection" width="50" :selectable="isSelectable">
|
|
|
|
+ </el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.subscribeOddNumbers')"
|
|
:label="$t('purchase_management.purchase.subscribeOddNumbers')"
|
|
align="center"
|
|
align="center"
|
|
prop="code"
|
|
prop="code"
|
|
|
|
+ width="150"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.goodCode')"
|
|
:label="$t('purchase_management.purchase.goodCode')"
|
|
align="center"
|
|
align="center"
|
|
- prop="name"
|
|
|
|
|
|
+ prop="goodsCode"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.goodName')"
|
|
:label="$t('purchase_management.purchase.goodName')"
|
|
align="center"
|
|
align="center"
|
|
- :formatter="showAddress"
|
|
|
|
|
|
+ prop="goodsName"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.goodType')"
|
|
:label="$t('purchase_management.purchase.goodType')"
|
|
align="center"
|
|
align="center"
|
|
- prop="contacts"
|
|
|
|
|
|
+ :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.unit')"
|
|
:label="$t('purchase_management.purchase.unit')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="goodsUnit"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.subscribeNums')"
|
|
:label="$t('purchase_management.purchase.subscribeNums')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="quantity"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.price')"
|
|
:label="$t('purchase_management.purchase.price')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="price"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.totalAmount')"
|
|
:label="$t('purchase_management.purchase.totalAmount')"
|
|
@@ -261,34 +320,38 @@ export default {
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.askArrivalTime')"
|
|
:label="$t('purchase_management.purchase.askArrivalTime')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="planArrivalTime"
|
|
|
|
+ width="160"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.subscribeReason')"
|
|
:label="$t('purchase_management.purchase.subscribeReason')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="cause"
|
|
/>
|
|
/>
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.purchaseStatus')"
|
|
:label="$t('purchase_management.purchase.purchaseStatus')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ :formatter="(row) => dictDataEcho(row.status, purchaseStatusList)"
|
|
/>
|
|
/>
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
:label="$t('purchase_management.purchase.subscribePeople')"
|
|
:label="$t('purchase_management.purchase.subscribePeople')"
|
|
align="center"
|
|
align="center"
|
|
- prop="phone"
|
|
|
|
|
|
+ prop="createName"
|
|
/>
|
|
/>
|
|
|
|
|
|
<el-table-column :label="$t('operation')" align="center" width="120">
|
|
<el-table-column :label="$t('operation')" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-button type="text" @click="handleEdit(scope.row)"
|
|
|
|
- >{{ $t("edit") }}
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ type="text"
|
|
|
|
+ v-if="scope.row.status === 10"
|
|
|
|
+ @click="handlePurchase(scope.row)"
|
|
|
|
+ >{{ $t("purchase_management.purchase.purchase") }}
|
|
</el-button>
|
|
</el-button>
|
|
- <el-button type="text" @click="handleDelete(scope.row)"
|
|
|
|
|
|
+ <!-- <el-button type="text" @click="handleDelete(scope.row)"
|
|
>{{ $t("delete") }}
|
|
>{{ $t("delete") }}
|
|
- </el-button>
|
|
|
|
|
|
+ </el-button> -->
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -307,6 +370,9 @@ export default {
|
|
>
|
|
>
|
|
<add-purchase
|
|
<add-purchase
|
|
:form="form"
|
|
:form="form"
|
|
|
|
+ :supplyTypeList="supplyTypeList"
|
|
|
|
+ :supplySelectList="supplySelectList"
|
|
|
|
+ :productTypeList="productTypeList"
|
|
@submit="handleSubmit"
|
|
@submit="handleSubmit"
|
|
@cancel="handleCancel"
|
|
@cancel="handleCancel"
|
|
ref="sendSubscribe"
|
|
ref="sendSubscribe"
|