From 26c39cd359bc0d2edc88408ff51ef70554e32a90 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期四, 29 二月 2024 09:48:17 +0800
Subject: [PATCH] 跟进记录明细报价单没点击弹框下拉数据为空的问题选择机会或者报价单赋值客户名称
---
src/views/sales/quotation/AddQuotationDialog.vue | 150 +++++++++++++++++++++++++++++++------------------
1 files changed, 95 insertions(+), 55 deletions(-)
diff --git a/src/views/sales/quotation/AddQuotationDialog.vue b/src/views/sales/quotation/AddQuotationDialog.vue
index 8684bc1..8bd4326 100644
--- a/src/views/sales/quotation/AddQuotationDialog.vue
+++ b/src/views/sales/quotation/AddQuotationDialog.vue
@@ -453,6 +453,9 @@
saleChancelist: []
}
},
+ mounted(){
+ this.getSaleChanceList()
+ },
created() {
this.$store.dispatch("geClient")
this.$store.dispatch("geContact")
@@ -515,50 +518,50 @@
saveClick(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
+ // for (let i = 0; i < this.tableData.length; i++) {
+ // if (this.tableData[i].name.length === 0) {
+ // this.isNoProduct = true
+ // break
+ // } else {
+ // this.isNoProduct = false
+ // }
+ // }
+ // if (this.isNoProduct) {
+ // this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
+ // } else {
for (let i = 0; i < this.tableData.length; i++) {
- if (this.tableData[i].name.length === 0) {
- this.isNoProduct = true
- break
- } else {
- this.isNoProduct = false
- }
- }
- if (this.isNoProduct) {
- this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
- } else {
- for (let i = 0; i < this.tableData.length; i++) {
- if (this.tableData[i].cost) {
- let reg =/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
- if (!reg.test(this.tableData[i].cost)) {
- this.$message.error("鎴愭湰鍗曚环闇�瑕佸~鍐欏ぇ浜�0鐨�2浣嶅皬鏁帮紒")
- return true
- }
+ if (this.tableData[i].cost) {
+ let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+ if (!reg.test(this.tableData[i].cost)) {
+ this.$message.error("鎴愭湰鍗曚环闇�瑕佸~鍐欏ぇ浜�0鐨�2浣嶅皬鏁帮紒")
+ return true
}
}
- const params = this.saveParams()
- if (this.editConfig.title === "鏂板缓") {
- getAddQuotation(params).then((res) => {
- console.log(res)
- this.editConfig.visible = false
- if (res.code === 200) {
- this.$message.success("娣诲姞鎴愬姛")
- this.$parent.getData()
- }
- })
- } else {
- getUpdateQuotation(params).then((res) => {
- this.editConfig.visible = false
- if (res.code === 200) {
- this.$message.success("缂栬緫鎴愬姛")
- this.$parent.getData()
- }
- })
- }
}
- } else {
- console.log("error submit")
- return false
+ const params = this.saveParams()
+ if (this.editConfig.title === "鏂板缓") {
+ getAddQuotation(params).then((res) => {
+ console.log(res)
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("娣诲姞鎴愬姛")
+ this.$parent.getData()
+ }
+ })
+ } else {
+ getUpdateQuotation(params).then((res) => {
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("缂栬緫鎴愬姛")
+ this.$parent.getData()
+ }
+ })
+ }
}
+ // } else {
+ // console.log("error submit")
+ // return false
+ // }
})
},
/**
@@ -573,6 +576,12 @@
},
saveParams() {
let data = this.editConfig.infomation
+ let products = []
+ this.tableData.map((item) => {
+ if (item.number.length > 0) {
+ products.push(item)
+ }
+ })
let params = {
id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
quotationName: data.quotationName || "",
@@ -583,7 +592,7 @@
quotation_status_id: data.quotation_status_id || 0,
sale_chance_id: this.saleChanceId || 0,
validity_date: data.validity_date || "",
- products: this.tableData,
+ products: products,
codeStandID: data.ID,
client_id: this.clientId || 0
}
@@ -611,12 +620,19 @@
}
},
handleSelectClient(value, item) {
- console.log(value)
+ console.log(item,'item')
if (value === "client") {
this.clientId = item.id
+ this.editConfig.infomation.client_name = item.name
this.getSaleChanceList(item)
} else if (value === "chance") {
this.saleChanceId = item.id
+ this.editConfig.infomation.sale_chance_name = item.name
+ this.editConfig.infomation.client_name = item.client.name
+ this.clientId = item.client.id
+ this.getSaleChanceList({id:this.clientId})
+ this.productTableList.tableData = item.products ? item.products : []
+ this.tableData = item.products ? item.products : []
} else {
this.contactId = item.id
}
@@ -638,7 +654,11 @@
this.contactId = row.id
} else if (value === "chance") {
this.editConfig.infomation.sale_chance_name = row.name
+ this.editConfig.infomation.client_name = row.client.name
+ this.clientId = row.client.id
this.saleChanceId = row.id
+ this.productTableList.tableData = row.products ? row.products : []
+ this.tableData = row.products ? row.products : []
} else {
this.editConfig.infomation.client_name = row.name
this.clientId = row.id
@@ -651,24 +671,38 @@
if (value === "client") {
this.editConfig.infomation.client_name = ""
this.clientId = 0
+ this.getSaleChanceList()
} else if (value === "chance") {
this.editConfig.infomation.sale_chance_name = ""
this.saleChanceId = 0
+ this.getSaleChanceList({id:this.clientId})
} else {
this.editConfig.infomation.contact_name = ""
this.contactId = 0
}
+
+ this.productTableList.tableData = []
+ this.tableData = []
this.refresh()
},
// 閿�鍞満浼氬垪琛�
async getSaleChanceList(item) {
- await getSaleChanceList({
- page: 1,
- pageSize: 15,
- search_map: {
+ let params={}
+ if(item){
+ params={
+ page: 0,
+ pageSize: 0,
+ }
+ params.search_map={
client_id: item.id
}
- }).then((res) => {
+ }else{
+ params={
+ page: 0,
+ pageSize: 0,
+ }
+ }
+ await getSaleChanceList(params).then((res) => {
console.log(res)
this.saleChancelist = res.data.list
})
@@ -703,8 +737,9 @@
}
this.productTableList = {
tableData: this.tableData,
+ isReturn: true,
tableColumn: [
- { label: "#", prop: "productId", width: 40 },
+ // { label: "#", prop: "productId", width: 40 },
{ label: "浜у搧鍚嶇О", prop: "name", productName: true, isRequird: true, min: 110 },
{ label: "浜у搧缂栧彿", prop: "number" },
{ label: "鍗曚綅", prop: "unit" },
@@ -719,9 +754,9 @@
},
// 浜у搧鍒楄〃杈撳叆
inputContent(val, prop, row) {
- this.productId = row.productId
+ // this.productId = row.productId
this.tableData.map((item) => {
- if (item.productId === row.productId) {
+ if (item.number === row.number) {
item[prop] = val
}
})
@@ -746,13 +781,18 @@
// this.showSummary.show = true
},
// 鏂板鏂瑰紡淇敼
- getSelectArray(val) {
- if (val.length > 0) {
- val.map((item, index) => {
- item.productId = this.tableData.length + index + 1
- })
+ getSelectArray(val, index) {
+ if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
+ this.tableData = []
}
- this.tableData = this.tableData.concat(val)
+ if (index < this.tableData.length) {
+ this.tableData.splice(index, 1)
+ val.map((item, ind) => {
+ this.tableData.splice(index + ind, 0, item)
+ })
+ } else {
+ this.tableData = this.tableData.concat(val)
+ }
this.productTableList.tableData = this.tableData
this.showSummary.show = true
},
--
Gitblit v1.8.0