|
|
|
@ -73,44 +73,40 @@ |
|
|
|
</div> |
|
|
|
<div style="margin-left: 10px; margin-top: 5%"> |
|
|
|
<div style="margin-top: 10px"> |
|
|
|
<el-button type="primary" @click="add">新增</el-button> |
|
|
|
<el-button type="primary" @click="add" class="btnClass">新增</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 10px"> |
|
|
|
<el-button type="success" @click="edit">编辑</el-button> |
|
|
|
<el-button type="success" @click="edit" class="btnClass">编辑</el-button> |
|
|
|
</div> |
|
|
|
<div style="margin-top: 10px"> |
|
|
|
<el-button type="danger" @click="del">删除</el-button> |
|
|
|
<el-button type="danger" @click="del" class="btnClass">删除</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 联系人 --> |
|
|
|
<el-dialog |
|
|
|
:title="formTitle" |
|
|
|
:visible.sync="dialogContactPerson" |
|
|
|
width="480" |
|
|
|
> |
|
|
|
<el-dialog :title="formTitle" :visible.sync="dialogContactPerson" width="800px"> |
|
|
|
<el-form :model="form" ref="form" label-width="100px" :rules="rules"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="联系人"> |
|
|
|
<el-input v-model="form.displayName"></el-input> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="displayName" label="联系人"> |
|
|
|
<el-input v-model="form.displayName" size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="职务"> |
|
|
|
<el-input v-model="form.title"></el-input> |
|
|
|
<el-input v-model="form.title" size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="备注"> |
|
|
|
<el-input v-model="form.remark"></el-input> |
|
|
|
<el-input type="textarea" v-model="form.remark" size="small" maxlength="50" show-word-limit></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-col :span="5"> |
|
|
|
<el-form-item label="创建者"> |
|
|
|
<el-input v-model="form.creatorName" disabled></el-input> |
|
|
|
<el-input v-model="form.creatorName" disabled size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="7"> |
|
|
|
@ -119,12 +115,12 @@ |
|
|
|
:value="form.creationTime | dateFormat" |
|
|
|
disabled |
|
|
|
style="width: 90%" |
|
|
|
></el-input> |
|
|
|
size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="5"> |
|
|
|
<el-form-item label="修改者" style="margin-left: -25%"> |
|
|
|
<el-input v-model="form.creatorName" disabled></el-input> |
|
|
|
<el-input v-model="form.creatorName" disabled size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="7"> |
|
|
|
@ -133,7 +129,7 @@ |
|
|
|
:value="form.lastModificationTime | dateFormat" |
|
|
|
disabled |
|
|
|
style="width: 90%" |
|
|
|
></el-input> |
|
|
|
size="small" ></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -143,30 +139,25 @@ |
|
|
|
border |
|
|
|
height="300" |
|
|
|
row-key="id" |
|
|
|
size="small" |
|
|
|
class="el-table__body-wrapper tbody" |
|
|
|
size="small" |
|
|
|
highlight-current-row |
|
|
|
ref="contactMethod" |
|
|
|
> |
|
|
|
<el-table-column prop="contactMethodType" label="类型"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-select v-model="customerOrg.contactMethodList[scope.$index].contactMethodType"> |
|
|
|
<el-select v-model="scope.row.contactMethodType" size="small" > |
|
|
|
<el-option v-for="item in Methodtypes" :key="item.value" :label="item.label" :value="item.value" /> |
|
|
|
</el-select> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="contactMethodValue" label="联系方式"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="customerOrg.contactMethodList[scope.$index].contactMethodValue" required/> |
|
|
|
<el-input v-model="scope.row.contactMethodValue" required size="small" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column fixed="right" label="操作" width="60"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<i |
|
|
|
class="el-icon-delete" |
|
|
|
@click="deleteRow(scope.$index)" |
|
|
|
size="medium" |
|
|
|
></i> |
|
|
|
<i class="el-icon-delete" @click="deleteRow(scope.$index)" style="font-size: 24px;color: red;cursor:pointer;" ></i> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
@ -174,7 +165,7 @@ |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="dialogContactPerson = false">取 消</el-button> |
|
|
|
<el-button type="success" @click="addMethod">新增联系方式</el-button> |
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
<el-button type="primary" @click="submit('form')">确 定</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
@ -199,7 +190,7 @@ export default { |
|
|
|
], |
|
|
|
|
|
|
|
rules: { |
|
|
|
displayName: [ |
|
|
|
displayName: [ |
|
|
|
{ required: true, message: "请输入名称", trigger: "blur" }, |
|
|
|
], |
|
|
|
}, |
|
|
|
@ -285,64 +276,72 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
//联系人信息提交 |
|
|
|
submit() { |
|
|
|
submit(formName) { |
|
|
|
let body = { |
|
|
|
customerOrgId: "", |
|
|
|
displayName: "", |
|
|
|
title: "", |
|
|
|
remark: "", |
|
|
|
}; |
|
|
|
objCopy(this.form, body); |
|
|
|
console.log("body", body); |
|
|
|
if (this.formTitle === "新增") { |
|
|
|
postapi("/api/app/contact-person", body) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-person') |
|
|
|
this.personId = res.data.id; |
|
|
|
this.formTitle = "编辑"; |
|
|
|
return deletapi(`/api/app/contact-method/many/${this.personId}`); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log(`deletapi api/app/contact-method/${this.personId}`) |
|
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
contactMethod.push({ |
|
|
|
contactMethodValue: item.contactMethodValue, |
|
|
|
contactMethodType: item.contactMethodType, |
|
|
|
contactPersonId: this.personId, |
|
|
|
this.$refs[formName].validate((valid,failField) => { |
|
|
|
if (valid) { |
|
|
|
objCopy(this.form, body); |
|
|
|
console.log("body", body); |
|
|
|
if (this.formTitle === "新增") { |
|
|
|
postapi("/api/app/contact-person", body) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-person') |
|
|
|
this.personId = res.data.id; |
|
|
|
this.formTitle = "编辑"; |
|
|
|
return deletapi(`/api/app/contact-method/many/${this.personId}`); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log(`deletapi api/app/contact-method/${this.personId}`) |
|
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
contactMethod.push({ |
|
|
|
contactMethodValue: item.contactMethodValue, |
|
|
|
contactMethodType: item.contactMethodType, |
|
|
|
contactPersonId: this.personId, |
|
|
|
}); |
|
|
|
}); |
|
|
|
return postapi("/api/app/contact-method/many", contactMethod); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-method/many') |
|
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return postapi("/api/app/contact-method/many", contactMethod); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-method/many') |
|
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
putapi(`/api/app/contact-person/${this.personId}`, body) |
|
|
|
.then((res) => { |
|
|
|
//console.log(`/api/app/contact-person/${this.personId}`) |
|
|
|
return deletapi(`/api/app/contact-method/many/${this.personId}`); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
console.log(`deletapi api/app/contact-method/${this.personId}`); |
|
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
contactMethod.push({ |
|
|
|
contactMethodValue: item.contactMethodValue, |
|
|
|
contactMethodType: item.contactMethodType, |
|
|
|
contactPersonId: this.personId, |
|
|
|
} else { |
|
|
|
putapi(`/api/app/contact-person/${this.personId}`, body) |
|
|
|
.then((res) => { |
|
|
|
//console.log(`/api/app/contact-person/${this.personId}`) |
|
|
|
return deletapi(`/api/app/contact-method/many/${this.personId}`); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
console.log(`deletapi api/app/contact-method/${this.personId}`); |
|
|
|
let contactMethod = []; //联系方式form表单数据 |
|
|
|
this.customerOrg.contactMethodList.forEach((item, index) => { |
|
|
|
contactMethod.push({ |
|
|
|
contactMethodValue: item.contactMethodValue, |
|
|
|
contactMethodType: item.contactMethodType, |
|
|
|
contactPersonId: this.personId, |
|
|
|
}); |
|
|
|
}); |
|
|
|
return postapi("/api/app/contact-method/many", contactMethod); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-method/many') |
|
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return postapi("/api/app/contact-method/many", contactMethod); |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
//console.log('api/app/contact-method/many') |
|
|
|
this.getContactPersonList(this.customerOrg.customerOrgId); |
|
|
|
this.$message.success("操作成功!"); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}else{ |
|
|
|
//console.log('failField',failField) |
|
|
|
this.$message.warning("未通过数据校验!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
//新增联系方式 |
|
|
|
@ -368,4 +367,8 @@ export default { |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
<style scoped></style> |
|
|
|
<style scoped> |
|
|
|
.btnClass{ |
|
|
|
width:110px; |
|
|
|
} |
|
|
|
</style> |