|
@@ -32,6 +32,18 @@
|
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
|
|
|
:disabled="detailData.status == 1" circle></el-button>
|
|
|
</template>
|
|
|
+ <template slot-scope="{row}" slot="defaultAddres">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.defaultAddres"
|
|
|
+ active-value="1"
|
|
|
+ inactive-value="0"
|
|
|
+ :disabled="!row.$cellEdit"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ @click="defaultAddresfun"
|
|
|
+ >
|
|
|
+ </el-switch>
|
|
|
+ </template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
<el-button size="small" type="text" @click="rowCell(row, index)">{{
|
|
|
row.$cellEdit ? "保存" : "修改"
|
|
@@ -87,8 +99,8 @@
|
|
|
@row-save="rowSave"
|
|
|
@row-update="rowUpdate"
|
|
|
@row-del="rowDelTwo">
|
|
|
- <template slot-scope="{ type, size, row }" slot="menu">
|
|
|
- <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
|
|
|
+ <template slot-scope="{ type, size, row, index }" slot="menu">
|
|
|
+ <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(contactsData[index])">创建用户</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</trade-card>
|
|
@@ -123,7 +135,15 @@
|
|
|
|
|
|
<script>
|
|
|
import { option2, option3 } from "./js/optionList";
|
|
|
-import { getDetails, addCorpType, getCorpType, submit, customerList, itemDel } from "@/api/basicData/client";
|
|
|
+import {
|
|
|
+ getDetails,
|
|
|
+ addCorpType,
|
|
|
+ getCorpType,
|
|
|
+ submitWeb,
|
|
|
+ customerList,
|
|
|
+ itemDel,
|
|
|
+ submitAttn, submitAddr
|
|
|
+} from "@/api/basicData/client";
|
|
|
import corpType from '@/components/corpType/index'
|
|
|
import customerContact from "@/views/basicData/customerInformation/configuration/customerContact.json";
|
|
|
import {corpsattn, creatingUsers} from "@/api/basicData/customerInformation";
|
|
@@ -252,11 +272,11 @@ export default {
|
|
|
value: "dictKey"
|
|
|
},
|
|
|
},
|
|
|
- {
|
|
|
- label: "期初欠款",
|
|
|
- prop: "arrears",
|
|
|
- span: 8,
|
|
|
- },
|
|
|
+ {
|
|
|
+ label: "联系人",
|
|
|
+ prop: "attn",
|
|
|
+ span: 8,
|
|
|
+ },
|
|
|
{
|
|
|
label: "电话",
|
|
|
prop: "tel",
|
|
@@ -267,11 +287,11 @@ export default {
|
|
|
prop: "telephone",
|
|
|
span: 8,
|
|
|
},
|
|
|
- {
|
|
|
- label: "传真",
|
|
|
- prop: "fax",
|
|
|
- span: 8,
|
|
|
- },
|
|
|
+ {
|
|
|
+ label: "期初欠款",
|
|
|
+ prop: "arrears",
|
|
|
+ span: 8,
|
|
|
+ },
|
|
|
{
|
|
|
label: "邮箱",
|
|
|
prop: "mailbox",
|
|
@@ -475,7 +495,22 @@ export default {
|
|
|
},
|
|
|
rowCell(row, index) {
|
|
|
if (row.$cellEdit == true) {
|
|
|
+ let i = 0
|
|
|
+ for(let item of this.data) {
|
|
|
+ if (item.defaultAddres == 1) {
|
|
|
+ i++
|
|
|
+ if (i > 1) {
|
|
|
+ this.$message.warning('默认地址只能有一个');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$set(row, "$cellEdit", false);
|
|
|
+ // 保存编辑接口
|
|
|
+ this.data[index].pid = this.form.id
|
|
|
+ submitAddr(this.data[index]).then(res=>{
|
|
|
+ this.data[index] = res.data.data
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$set(row, "$cellEdit", true);
|
|
|
}
|
|
@@ -574,13 +609,13 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
this.loadingBtn = true;
|
|
|
- submit({
|
|
|
+ submitWeb({
|
|
|
...this.form,
|
|
|
code: this.form.cname,
|
|
|
corpType: "KH",
|
|
|
- corpsAddrList: this.data,
|
|
|
+ // corpsAddrList: this.data,
|
|
|
corpsFiles: this.corpsFiles,
|
|
|
- corpsAttnList:this.contactsData,
|
|
|
+ // corpsAttnList:this.contactsData,
|
|
|
billType:1
|
|
|
}).then(res => {
|
|
|
this.$message.success("保存成功");
|
|
@@ -642,14 +677,30 @@ export default {
|
|
|
},
|
|
|
//新增客户联系人保存触发
|
|
|
rowSave(row, done, loading) {
|
|
|
- console.log(row, done, loading);
|
|
|
this.contactsData.push(row);
|
|
|
+ this.submitAttnfun(row)
|
|
|
done();
|
|
|
},
|
|
|
//修改客户联系人触发
|
|
|
rowUpdate(row, index, done, loading) {
|
|
|
+ this.submitAttnfun(row,index)
|
|
|
done(row);
|
|
|
},
|
|
|
+ // 保存客户联系接口
|
|
|
+ submitAttnfun(row,index){
|
|
|
+ if (index) {
|
|
|
+ this.contactsData[index].pid = this.form.id
|
|
|
+ this.contactsData[index] = {...row,...this.contactsData[index]}
|
|
|
+ submitAttn(this.contactsData[index]).then(res=>{
|
|
|
+ this.$set(this.contactsData,index,res.data.data)
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ row.pid = this.form.id
|
|
|
+ submitAttn(row).then(res=>{
|
|
|
+ this.contactsData[this.contactsData.length-1] = res.data.data
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
//删除客户联系人触发
|
|
|
rowDelTwo(row, index, donerowDel) {
|
|
|
this.$confirm("确定将选择数据删除?", {
|