|
|
@@ -13,7 +13,12 @@
|
|
|
<el-button v-permissions="['proj:business:customerContact:add']" icon="el-icon-plus" @click="handleAddContact">
|
|
|
新建客户联系人
|
|
|
</el-button>
|
|
|
- <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectContact">关联</el-button>
|
|
|
+ <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectCustomerContact">
|
|
|
+ 关联客户联系人
|
|
|
+ </el-button>
|
|
|
+ <el-button v-permissions="['proj:business:contact:associate']" @click="handleSelectDealerContact">
|
|
|
+ 关联渠道联系人
|
|
|
+ </el-button>
|
|
|
<el-button v-permissions="['proj:business:contact:disassociate']" type="danger" @click="handleDisassociation">
|
|
|
解除关联
|
|
|
</el-button>
|
|
|
@@ -27,6 +32,11 @@
|
|
|
@selection-change="setSelectRows">
|
|
|
<el-table-column align="center" type="selection" />
|
|
|
<el-table-column align="center" label="姓名" prop="cuctName" show-overflow-tooltip />
|
|
|
+ <el-table-column align="center" label="类型" prop="contactType" show-overflow-tooltip>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.contactType === '10' ? '客户' : '渠道' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column align="center" label="岗位" prop="postion" show-overflow-tooltip />
|
|
|
<el-table-column align="center" label="电话" prop="telephone" show-overflow-tooltip />
|
|
|
<el-table-column align="center" label="微信" prop="wechat" show-overflow-tooltip />
|
|
|
@@ -38,7 +48,7 @@
|
|
|
<!-- </template>-->
|
|
|
<!-- </el-table-column>-->
|
|
|
<el-table-column align="center" label="操作" show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
+ <template v-if="scope.row.contactType === '10'" slot-scope="scope">
|
|
|
<el-button
|
|
|
v-if="scope.row.contactId !== primacyContactId"
|
|
|
v-permissions="['proj:business:contact:primary']"
|
|
|
@@ -52,26 +62,34 @@
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 选择客户联系人弹窗 -->
|
|
|
- <select-contact
|
|
|
- ref="selectContact"
|
|
|
+ <select-customer-contact
|
|
|
+ ref="selectCustomerContact"
|
|
|
:default-customer="customerInfo"
|
|
|
:query-params="queryContact"
|
|
|
- @save="selectContact" />
|
|
|
+ @save="selectCustomerContact" />
|
|
|
<!-- 新建联系人弹窗 -->
|
|
|
- <customer-contact ref="contact" @contactSave="handleSelectContact" />
|
|
|
+ <customer-contact ref="contact" @contactSave="handleSelectCustomerContact" />
|
|
|
+
|
|
|
+ <!-- 选择渠道经销商联系人弹窗 -->
|
|
|
+ <select-distributor-contact
|
|
|
+ ref="selectDealerContact"
|
|
|
+ :default-dist="distributorInfo"
|
|
|
+ :query-params="queryDistContact"
|
|
|
+ @save="selectDealerContact" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import businessApi from '@/api/proj/business'
|
|
|
import businessContactApi from '@/api/proj/businessContact'
|
|
|
- import SelectContact from '@/components/select/SelectCustomerContact'
|
|
|
+ import SelectCustomerContact from '@/components/select/SelectCustomerContact'
|
|
|
+ import SelectDistributorContact from '@/components/select/SelectDistributorContact'
|
|
|
import CustomerContact from '@/views/customer/components/Contact'
|
|
|
import { getUUID } from '@/utils'
|
|
|
|
|
|
export default {
|
|
|
name: 'Records',
|
|
|
- components: { SelectContact, CustomerContact },
|
|
|
+ components: { CustomerContact, SelectCustomerContact, SelectDistributorContact },
|
|
|
props: {
|
|
|
// 项目Id
|
|
|
busId: {
|
|
|
@@ -90,6 +108,13 @@
|
|
|
return {}
|
|
|
},
|
|
|
},
|
|
|
+ // 渠道经销商信息{ distId: this.form.distributorId, distName: this.form.distributorName }
|
|
|
+ distributorInfo: {
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {}
|
|
|
+ },
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -103,6 +128,7 @@
|
|
|
selectRows: [],
|
|
|
contactList: [],
|
|
|
queryContact: {},
|
|
|
+ queryDistContact: {},
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -114,19 +140,41 @@
|
|
|
this.$refs.contact.contactForm.custName = this.customerInfo.custName
|
|
|
this.$refs.contact.contactVisible = true
|
|
|
},
|
|
|
- handleSelectContact() {
|
|
|
+ handleSelectCustomerContact() {
|
|
|
this.queryContact.custId = this.customerInfo.custId
|
|
|
if (!this.queryContact.custId) {
|
|
|
this.$message.warning('请先选择客户')
|
|
|
return
|
|
|
}
|
|
|
- this.$refs.selectContact.open()
|
|
|
+ this.$refs.selectCustomerContact.open()
|
|
|
+ },
|
|
|
+ async selectCustomerContact(val) {
|
|
|
+ if (val && val.length > 0) {
|
|
|
+ let form = {
|
|
|
+ busId: this.busId,
|
|
|
+ contactIds: val.map((item) => item.id),
|
|
|
+ contactType: '10',
|
|
|
+ }
|
|
|
+ const { msg } = await businessContactApi.doAdd(form)
|
|
|
+ this.$baseMessage(msg, 'success')
|
|
|
+ await this.fetchData()
|
|
|
+ this.$emit('fetch-data')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelectDealerContact() {
|
|
|
+ this.queryDistContact.distId = this.distributorInfo.distId
|
|
|
+ if (!this.queryDistContact.distId) {
|
|
|
+ this.$message.warning('请先选择渠道经销商')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs.selectDealerContact.open()
|
|
|
},
|
|
|
- async selectContact(val) {
|
|
|
+ async selectDealerContact(val) {
|
|
|
if (val && val.length > 0) {
|
|
|
let form = {
|
|
|
busId: this.busId,
|
|
|
contactIds: val.map((item) => item.id),
|
|
|
+ contactType: '20',
|
|
|
}
|
|
|
const { msg } = await businessContactApi.doAdd(form)
|
|
|
this.$baseMessage(msg, 'success')
|
|
|
@@ -138,7 +186,7 @@
|
|
|
if (this.selectRows.length > 0) {
|
|
|
const ids = this.selectRows.map((item) => item.id)
|
|
|
this.$baseConfirm('你确定要解除关联选中项吗', null, async () => {
|
|
|
- const { msg } = await businessContactApi.doDelete({ ids })
|
|
|
+ const { msg } = await businessContactApi.doDelete({ busId: this.busId, contactIds: ids })
|
|
|
this.$baseMessage(msg, 'success')
|
|
|
await this.fetchData()
|
|
|
this.$emit('fetch-data')
|