From 7fbfeddedebd05e2d23ce411be887106d31e8eff Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 27 三月 2024 15:02:18 +0800
Subject: [PATCH] 销售明细单产品列表添加动态表头,产品信息列表根据完成数量展示字体色
---
src/views/sales/salesDetails/AddSalesDetailsDialog.vue | 135 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 110 insertions(+), 25 deletions(-)
diff --git a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
index de79216..3422c40 100644
--- a/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
+++ b/src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -442,6 +442,7 @@
@getSelectArray="getSelectArray"
@emptyProductClick="emptyProductClick"
@clearupProduct="clearupProduct"
+ @selTableCol="selTableCol"
></CommonFormTableView>
</div>
<!-- 閫夋嫨瀹℃壒娴佺▼ -->
@@ -534,6 +535,7 @@
import { getDataByType } from "@/api/data"
import { mapActions } from "vuex"
import { getQuotationList } from "@/api/sales/quotation"
+import { getSystemSet } from "@/api/systemSet/commonSet"
export default {
name: "AddSalesDetailsDialog",
@@ -635,7 +637,25 @@
disabledDate(time) {
return time.getTime() > Date.now()
}
- }
+ },
+ isRelevancyValue:"鏄�", //鏄惁鍚屾鎶ヤ环鍗�
+ isCollectionPlan:"鏄�", // 鏄惁鐢熸垚鏀舵璁″垝
+ isBjdRequird : false,
+ tableColumn: [
+ // { label: "#", prop: "productId", width: 40 },
+ { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
+ { label: "瑙勬牸", prop: "specs" , },
+ { label: "鍨嬪彿", prop: "type" },
+ { label: "浜у搧缂栧彿", prop: "number" },
+ { label: "鍗曚綅", prop: "unit" },
+ { label: "閿�鍞崟浠�", prop: "price", inputFloat: !this.isBjdRequird, },
+ { label: "鎴愭湰鍗曚环", prop: "cost", input: !this.isBjdRequird },
+ { label: "姣涘埄", prop: "profit" },
+ { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
+ { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+ { label: "浠风◣鍚堣", prop: "total" }
+ ],
+ showCol: ["浜у搧鍚嶇О", "瑙勬牸", "鍨嬪彿", "浜у搧缂栧彿", "鍗曚綅", "閿�鍞崟浠�", "鎴愭湰鍗曚环","姣涘埄","姣涘埄鐜�(%)","鏁伴噺","浠风◣鍚堣"],
}
},
mounted(){
@@ -643,6 +663,7 @@
this.getQuotation()
},
created() {
+ this.getSystemSet()
if (this.editConfig.title !== "鏂板缓") {
this.productTableList.tableData = [
{
@@ -684,6 +705,41 @@
// },
methods: {
...mapActions(["getChanceFilter", "getSubunitFliter"]),
+ async getSystemSet(){
+ await getSystemSet().then((res) => {
+ if (res.code == 200) {
+ console.log(res,"resss")
+ if (res.data) {
+ this.isRelevancyValue = this.checkValueById(res.data.CRM, 5);
+ this.isCollectionPlan=this.checkValueById(res.data.CRM, 4);
+ console.log(this.isRelevancyValue,"鏄惁鍏宠仈")
+ }
+ }
+ })
+ },
+ setColumnVisible(showCol, tableColumn) {
+ return tableColumn.map((ele) => {
+ return {
+ ...ele,
+ isShowColumn: showCol.includes(ele.label)
+ }
+ })
+ },
+ selTableCol(val) {
+ this.showcol = val
+ this.productTableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
+ },
+ checkValueById(data, id) {
+ for (const key in data) {
+ if (data.hasOwnProperty(key)) {
+ const obj = data[key];
+ if (obj.id === id) {
+ return obj.value;
+ }
+ }
+ }
+ return null; // 濡傛灉娌℃湁鎵惧埌鍖归厤鐨刬d锛屽垯杩斿洖null
+ },
formInfo() {
this.objCode.type = "閿�鍞槑缁嗙紪鐮�"
this.objCode.codeStandID = ""
@@ -754,7 +810,11 @@
amountTotal: this.amountTotal,
id: res.data.id
}
- this.$emit("addCollectionPlanClick", config)
+ if(this.isCollectionPlan==="鏄�"){
+ this.$emit("addCollectionPlanClick", config)
+ }else{
+ this.$parent.getData()
+ }
}
})
} else {
@@ -936,9 +996,11 @@
console.log("涓嬫媺妗嗙偣鍑�", item)
this.subbillId = item.id
this.editConfig.infomation.subbill_name = item.number
- } else if (value === "quotation") {
- this.productTableList.tableData = item.products
- this.tableData = item.products
+ } else if (value === "quotation") { //閿�鍞姤浠峰崟
+ if(this.isRelevancyValue==="鏄�"){
+ this.productTableList.tableData = item.products
+ this.tableData = item.products
+ }
this.editConfig.infomation.quotation_number = item.number
this.quotationId = item.id
//鍙嶅悜 瀹㈡埛鍚嶇О
@@ -978,6 +1040,7 @@
this.editSelCommonConfig.editVisible = true
}
},
+ // 鐐瑰嚮鍔犲彿
selClient(row, value) {
if (value === "client") {
this.editConfig.infomation.sale_chance_name = ""
@@ -1002,8 +1065,10 @@
this.editConfig.infomation.subbill_name = row.number
this.subbillId = row.id
} else if (value === "quotation") {
- this.productTableList.tableData = row.products
- this.tableData = row.products
+ if(this.isRelevancyValue==="鏄�"){
+ this.productTableList.tableData = row.products
+ this.tableData = row.products
+ }
this.editConfig.infomation.quotation_number = row.number
//鍙嶅悜 瀹㈡埛鍚嶇О
this.editConfig.infomation.client_name = row.client.name
@@ -1040,8 +1105,15 @@
this.editConfig.infomation.quotation_number = ""
this.quotationId = 0
}
- this.productTableList.tableData = []
- this.tableData = []
+ if(this.isRelevancyValue==="鏄�" && value === "quotation"){
+ this.productTableList.tableData = []
+ this.tableData = []
+ }else if(this.isRelevancyValue==="鍚�" && value === "quotation"){
+ console.log("false")
+ }else{
+ this.productTableList.tableData = []
+ this.tableData = []
+ }
},
// 娣诲姞闄勪欢
addAnnexClick() {},
@@ -1073,27 +1145,40 @@
this.getQuotation(this.editConfig.infomation.saleChanceId, "鍏ㄩ儴浜у搧")
}
// let productData = this.quotationList.products
- let isBjdRequird = false
+ this.isBjdRequird = false
if (this.autoCodeHeadersObj.Bjd == "yes") {
- isBjdRequird = true
+ this.isBjdRequird = true
}
this.productTableList = {
tableData: this.tableData,
isReturn: true,
- tableColumn: [
- // { label: "#", prop: "productId", width: 40 },
- { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
- { label: "瑙勬牸", prop: "specs" },
- { label: "鍨嬪彿", prop: "type" },
- { label: "浜у搧缂栧彿", prop: "number" },
- { label: "鍗曚綅", prop: "unit" },
- { label: "閿�鍞崟浠�", prop: "price", inputFloat: !isBjdRequird, isRequird: true },
- { label: "鎴愭湰鍗曚环", prop: "cost", input: !isBjdRequird },
- { label: "姣涘埄", prop: "profit" },
- { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
- { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
- { label: "浠风◣鍚堣", prop: "total" }
- ]
+ allcol: [],
+ showcol: this.showCol,
+ // tableColumn: [
+ // // { label: "#", prop: "productId", width: 40 },
+ // { label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
+ // { label: "瑙勬牸", prop: "specs" },
+ // { label: "鍨嬪彿", prop: "type" },
+ // { label: "浜у搧缂栧彿", prop: "number" },
+ // { label: "鍗曚綅", prop: "unit" },
+ // { label: "閿�鍞崟浠�", prop: "price", inputFloat: !this.isBjdRequird, },
+ // { label: "鎴愭湰鍗曚环", prop: "cost", input: !this.isBjdRequird },
+ // { label: "姣涘埄", prop: "profit" },
+ // { label: "姣涘埄鐜�(%)", prop: "margin", min: 90 },
+ // { label: "鏁伴噺", prop: "amount", inputNumber: true, isRequird: true },
+ // { label: "浠风◣鍚堣", prop: "total" }
+ // ],
+ tableColumn: this.setColumnVisible(this.showCol, this.tableColumn)
+ }
+ this.setTableList(this.productTableList)
+ },
+ setTableList(productTableList) {
+ productTableList.allcol = productTableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
+ this.searchOptions = []
+ for (let i = 0; i < productTableList.tableColumn.length; i++) {
+ const label = productTableList.tableColumn[i].label
+ const value = productTableList.tableColumn[i].prop
+ this.searchOptions.push({ value: value, label: label })
}
},
// 浜у搧鍒楄〃杈撳叆
--
Gitblit v1.8.0