|
|
@ -108,7 +108,7 @@ |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
<el-table :data="customerOrg.contactMethodList" border height="300" row-key="id" size="small" |
|
|
|
|
|
|
|
|
<el-table :data="contactMethodListEdit" border height="300" row-key="id" size="small" |
|
|
highlight-current-row ref="contactMethod" style="margin-top: 20px;"> |
|
|
highlight-current-row ref="contactMethod" style="margin-top: 20px;"> |
|
|
<el-table-column prop="contactMethodType" label="类型" width="200"> |
|
|
<el-table-column prop="contactMethodType" label="类型" width="200"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
@ -142,7 +142,7 @@ |
|
|
import moment from "moment"; |
|
|
import moment from "moment"; |
|
|
import { mapState } from "vuex"; |
|
|
import { mapState } from "vuex"; |
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
import { getapi, postapi, putapi, deletapi } from "@/api/api"; |
|
|
import { objCopy } from "../../utlis/proFunc"; |
|
|
|
|
|
|
|
|
import { objCopy, deepCopy, arrayExistObj } from "../../utlis/proFunc"; |
|
|
export default { |
|
|
export default { |
|
|
components: {}, |
|
|
components: {}, |
|
|
props:["customerOrgId"], |
|
|
props:["customerOrgId"], |
|
|
@ -150,6 +150,7 @@ export default { |
|
|
return { |
|
|
return { |
|
|
personId: "", |
|
|
personId: "", |
|
|
form: {}, //联系人表单信息 |
|
|
form: {}, //联系人表单信息 |
|
|
|
|
|
contactMethodListEdit:[], //联系方式(可修改) |
|
|
formTitle: "新增", |
|
|
formTitle: "新增", |
|
|
dialogContactPerson: false, //联系人弹窗 显示控制 |
|
|
dialogContactPerson: false, //联系人弹窗 显示控制 |
|
|
|
|
|
|
|
|
@ -196,6 +197,7 @@ export default { |
|
|
}).then((res) => { |
|
|
}).then((res) => { |
|
|
//console.log('res.data',res.data) |
|
|
//console.log('res.data',res.data) |
|
|
this.customerOrg.contactMethodList = res.data; |
|
|
this.customerOrg.contactMethodList = res.data; |
|
|
|
|
|
this.contactMethodListEdit = deepCopy(res.data); |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -245,29 +247,31 @@ export default { |
|
|
}).then((res) => { |
|
|
}).then((res) => { |
|
|
if(res.code != -1) { |
|
|
if(res.code != -1) { |
|
|
this.personId = ""; |
|
|
this.personId = ""; |
|
|
|
|
|
|
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
|
|
|
|
|
this.customerOrg.contactMethodList = []; |
|
|
this.customerOrg.contactMethodList = []; |
|
|
this.$message.success("操作成功!"); |
|
|
this.$message.success("操作成功!"); |
|
|
} |
|
|
} |
|
|
}).catch((err) => { |
|
|
}).catch((err) => { |
|
|
console.log(`deletapi:/api/app/contact-person/${this.personId}`,err); |
|
|
|
|
|
|
|
|
if (err == "cancel") { |
|
|
|
|
|
this.$message.info("已取消删除"); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//删除联系方式行 |
|
|
//删除联系方式行 |
|
|
deleteRow(index) { |
|
|
deleteRow(index) { |
|
|
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { |
|
|
|
|
|
|
|
|
this.$confirm("此操作确定后将永久删除该记录, 是否继续?", "提示", { |
|
|
confirmButtonText: "是", |
|
|
confirmButtonText: "是", |
|
|
cancelButtonText: "否", |
|
|
cancelButtonText: "否", |
|
|
type: "warning", |
|
|
type: "warning", |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
this.customerOrg.contactMethodList.splice(index, 1); |
|
|
|
|
|
this.submit('form'); |
|
|
|
|
|
|
|
|
this.contactMethodListEdit.splice(index, 1); |
|
|
|
|
|
//this.submit('form'); |
|
|
}).catch((err) => { |
|
|
}).catch((err) => { |
|
|
if(err == 'cancel'){ |
|
|
if(err == 'cancel'){ |
|
|
this.$message.info("已取消删除"); |
|
|
this.$message.info("已取消删除"); |
|
|
}else{ |
|
|
|
|
|
this.$message.error("操作失败,原因:" + err); |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -281,11 +285,15 @@ export default { |
|
|
title: "", |
|
|
title: "", |
|
|
remark: "", |
|
|
remark: "", |
|
|
}; |
|
|
}; |
|
|
this.$refs[formName].validate((valid, failField) => { |
|
|
|
|
|
if (valid) { |
|
|
|
|
|
|
|
|
this.$refs[formName].validate((valid, fields) => { |
|
|
|
|
|
if (!valid){ |
|
|
|
|
|
this.$message.warning(fields[Object.keys(fields)[0]][0].message); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
objCopy(this.form, body); |
|
|
objCopy(this.form, body); |
|
|
console.log("body", body); |
|
|
console.log("body", body); |
|
|
if (this.formTitle === "新增") { |
|
|
|
|
|
|
|
|
if (this.formTitle == "新增") { |
|
|
postapi("/api/app/contact-person", body) |
|
|
postapi("/api/app/contact-person", body) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
//console.log('api/app/contact-person') |
|
|
//console.log('api/app/contact-person') |
|
|
@ -296,7 +304,7 @@ export default { |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
//console.log(`deletapi api/app/contact-method/${this.personId}`) |
|
|
//console.log(`deletapi api/app/contact-method/${this.personId}`) |
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
|
|
|
|
|
this.contactMethodListEdit.forEach( item => { |
|
|
contactMethod.push({ |
|
|
contactMethod.push({ |
|
|
contactMethodValue: item.contactMethodValue, |
|
|
contactMethodValue: item.contactMethodValue, |
|
|
contactMethodType: item.contactMethodType, |
|
|
contactMethodType: item.contactMethodType, |
|
|
@ -307,7 +315,10 @@ export default { |
|
|
}) |
|
|
}) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
//console.log('api/app/contact-method/many') |
|
|
//console.log('api/app/contact-method/many') |
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
|
|
|
|
|
//this.getContactPersonList(this.customerOrgId); //改成局部刷新 |
|
|
|
|
|
this.customerOrg.contactPersonList.push(res.data) |
|
|
|
|
|
this.getContactMethodList(res.data.id) |
|
|
|
|
|
|
|
|
this.$message.success("操作成功!"); |
|
|
this.$message.success("操作成功!"); |
|
|
this.dialogContactPerson = false |
|
|
this.dialogContactPerson = false |
|
|
}); |
|
|
}); |
|
|
@ -320,7 +331,7 @@ export default { |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
console.log(`deletapi api/app/contact-method/${this.personId}`); |
|
|
console.log(`deletapi api/app/contact-method/${this.personId}`); |
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
|
|
|
|
|
this.contactMethodListEdit.forEach((item, index) => { |
|
|
contactMethod.push({ |
|
|
contactMethod.push({ |
|
|
contactMethodValue: item.contactMethodValue, |
|
|
contactMethodValue: item.contactMethodValue, |
|
|
contactMethodType: item.contactMethodType, |
|
|
contactMethodType: item.contactMethodType, |
|
|
@ -331,22 +342,21 @@ export default { |
|
|
}) |
|
|
}) |
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
//console.log('api/app/contact-method/many') |
|
|
//console.log('api/app/contact-method/many') |
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
|
|
|
|
|
//this.getContactPersonList(this.customerOrgId); //改成局部刷新 |
|
|
|
|
|
let lfind = arrayExistObj(this.customerOrg.contactPersonList, 'id', this.personId) |
|
|
|
|
|
if(lfind > - 1) objCopy(body,this.customerOrg.contactPersonList[lfind]) |
|
|
|
|
|
this.getContactMethodList(this.personId) |
|
|
|
|
|
|
|
|
this.$message.success("操作成功!"); |
|
|
this.$message.success("操作成功!"); |
|
|
this.dialogContactPerson = false |
|
|
this.dialogContactPerson = false |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
//console.log('failField',failField) |
|
|
|
|
|
this.$message.warning("未通过数据校验!"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
//新增联系方式 |
|
|
//新增联系方式 |
|
|
addMethod() { |
|
|
addMethod() { |
|
|
this.customerOrg.contactMethodList.push({ |
|
|
|
|
|
|
|
|
this.contactMethodListEdit.push({ |
|
|
contactMethodValue: "", |
|
|
contactMethodValue: "", |
|
|
contactMethodType: "0", |
|
|
contactMethodType: "0", |
|
|
contactPersonId: this.personId, |
|
|
contactPersonId: this.personId, |
|
|
@ -356,7 +366,7 @@ export default { |
|
|
rowClick(row) { |
|
|
rowClick(row) { |
|
|
console.log("row", row); |
|
|
console.log("row", row); |
|
|
// this.$message.success("rowClick"); |
|
|
// this.$message.success("rowClick"); |
|
|
this.form = row; |
|
|
|
|
|
|
|
|
this.form = deepCopy(row); |
|
|
this.personId = row.id; |
|
|
this.personId = row.id; |
|
|
this.getContactMethodList(row.id); |
|
|
this.getContactMethodList(row.id); |
|
|
}, |
|
|
}, |
|
|
|