CRM:完善数据权限,实现数据权限同时添加、同时转移

This commit is contained in:
puhui999
2024-03-03 20:11:52 +08:00
parent 3660cd26ae
commit 13e925e29f
15 changed files with 159 additions and 111 deletions

View File

@@ -6,18 +6,20 @@
创建联系人
</el-button>
<el-button
@click="openBusinessModal"
v-hasPermi="['crm:contact:create-business']"
v-if="queryParams.businessId"
v-hasPermi="['crm:contact:create-business']"
@click="openBusinessModal"
>
<Icon class="mr-5px" icon="ep:circle-plus" />关联
<Icon class="mr-5px" icon="ep:circle-plus" />
关联
</el-button>
<el-button
@click="deleteContactBusinessList"
v-hasPermi="['crm:contact:delete-business']"
v-if="queryParams.businessId"
v-hasPermi="['crm:contact:delete-business']"
@click="deleteContactBusinessList"
>
<Icon class="mr-5px" icon="ep:remove" />解除关联
<Icon class="mr-5px" icon="ep:remove" />
解除关联
</el-button>
</el-row>
@@ -27,21 +29,21 @@
ref="contactRef"
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
:stripe="true"
>
<el-table-column type="selection" width="55" v-if="queryParams.businessId" />
<el-table-column label="姓名" fixed="left" align="center" prop="name">
<el-table-column v-if="queryParams.businessId" type="selection" width="55" />
<el-table-column align="center" fixed="left" label="姓名" prop="name">
<template #default="scope">
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }}
</el-link>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="职位" align="center" prop="post" />
<el-table-column label="直属上级" align="center" prop="parentName" />
<el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
<el-table-column align="center" label="手机号" prop="mobile" />
<el-table-column align="center" label="职位" prop="post" />
<el-table-column align="center" label="直属上级" prop="parentName" />
<el-table-column align="center" label="是否关键决策人" min-width="100" prop="master">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
</template>
@@ -49,9 +51,9 @@
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
@@ -60,12 +62,13 @@
<ContactForm ref="formRef" @success="getList" />
<!-- 关联商机选择弹框 -->
<ContactListModal
v-if="customerId"
ref="contactModalRef"
:customer-id="props.customerId"
:customer-id="customerId"
@success="createContactBusinessList"
/>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import * as ContactApi from '@/api/crm/contact'
import ContactForm from './../ContactForm.vue'
import { DICT_TYPE } from '@/utils/dict'
@@ -76,8 +79,8 @@ defineOptions({ name: 'CrmContactList' })
const props = defineProps<{
bizType: number // 业务类型
bizId: number // 业务编号
customerId: number // 特殊:客户编号;在【商机】详情中,可以传递客户编号,默认新建的联系人关联到该客户
businessId: number // 特殊:商机编号;在【商机】详情中,可以传递商机编号,默认新建的联系人关联到该商机
customerId?: number // 特殊:客户编号;在【商机】详情中,可以传递客户编号,默认新建的联系人关联到该客户
businessId?: number // 特殊:商机编号;在【商机】详情中,可以传递商机编号,默认新建的联系人关联到该商机
}>()
const loading = ref(true) // 列表的加载中
@@ -147,7 +150,7 @@ const createContactBusinessList = async (contactIds: number[]) => {
contactIds: contactIds
} as ContactApi.ContactBusiness2ReqVO
contactRef.value.getSelectionRows().forEach((row: ContactApi.ContactVO) => {
data.businessIds.push(row.id)
data.contactIds.push(row.id)
})
await ContactApi.createContactBusinessList2(data)
// 刷新列表

View File

@@ -1,28 +1,35 @@
<template>
<Dialog title="关联联系人" v-model="dialogVisible">
<Dialog v-model="dialogVisible" title="关联联系人">
<!-- 搜索工作栏 -->
<ContentWrap>
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
:model="queryParams"
class="-mb-15px"
label-width="90px"
>
<el-form-item label="联系人名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入联系人名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
clearable
placeholder="请输入联系人名称"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
<el-button type="primary" @click="openForm()" v-hasPermi="['crm:business:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
<el-button @click="handleQuery">
<Icon class="mr-5px" icon="ep:search" />
搜索
</el-button>
<el-button @click="resetQuery">
<Icon class="mr-5px" icon="ep:refresh" />
重置
</el-button>
<el-button v-hasPermi="['crm:business:create']" type="primary" @click="openForm()">
<Icon class="mr-5px" icon="ep:plus" />
新增
</el-button>
</el-form-item>
</el-form>
@@ -31,24 +38,24 @@
<!-- 列表 -->
<ContentWrap class="mt-10px">
<el-table
v-loading="loading"
ref="contactRef"
v-loading="loading"
:data="list"
:stripe="true"
:show-overflow-tooltip="true"
:stripe="true"
>
<el-table-column type="selection" width="55" />
<el-table-column label="姓名" fixed="left" align="center" prop="name">
<el-table-column align="center" fixed="left" label="姓名" prop="name">
<template #default="scope">
<el-link type="primary" :underline="false" @click="openDetail(scope.row.id)">
<el-link :underline="false" type="primary" @click="openDetail(scope.row.id)">
{{ scope.row.name }}
</el-link>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="职位" align="center" prop="post" />
<el-table-column label="直属上级" align="center" prop="parentName" />
<el-table-column label="是否关键决策人" align="center" prop="master" min-width="100">
<el-table-column align="center" label="手机号" prop="mobile" />
<el-table-column align="center" label="职位" prop="post" />
<el-table-column align="center" label="直属上级" prop="parentName" />
<el-table-column align="center" label="是否关键决策人" min-width="100" prop="master">
<template #default="scope">
<dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.master" />
</template>
@@ -56,14 +63,14 @@
</el-table>
<!-- 分页 -->
<Pagination
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNo"
:total="total"
@pagination="getList"
/>
</ContentWrap>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-button :disabled="formLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</template>
@@ -71,10 +78,9 @@
<ContactForm ref="formRef" @success="getList" />
</Dialog>
</template>
<script setup lang="ts">
<script lang="ts" setup>
import * as ContactApi from '@/api/crm/contact'
import ContactForm from '../ContactForm.vue'
import { erpPriceTableColumnFormatter } from '@/utils'
import { DICT_TYPE } from '@/utils/dict'
const message = useMessage() // 消息弹窗

View File

@@ -31,15 +31,15 @@
<BusinessList
:biz-id="contact.id!"
:biz-type="BizTypeEnum.CRM_CONTACT"
:customer-id="contact.customerId"
:contact-id="contact.id"
:customer-id="contact.customerId"
/>
</el-tab-pane>
</el-tabs>
</el-col>
<!-- 表单弹窗添加/修改 -->
<ContactForm ref="formRef" @success="getContact(contact.id)" />
<CrmTransferForm ref="transferFormRef" @success="close" />
<ContactForm ref="formRef" @success="getContact" />
<CrmTransferForm ref="transferFormRef" :biz-type="BizTypeEnum.CRM_CONTACT" @success="close" />
</template>
<script lang="ts" setup>
import { useTagsViewStore } from '@/store/modules/tagsView'
@@ -65,11 +65,11 @@ const contact = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) // 联系
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
/** 获取详情 */
const getContact = async (id: number) => {
const getContact = async () => {
loading.value = true
try {
contact.value = await ContactApi.getContact(id)
await getOperateLog(id)
contact.value = await ContactApi.getContact(contactId.value)
await getOperateLog(contactId.value)
} finally {
loading.value = false
}
@@ -84,7 +84,7 @@ const openForm = (type: string, id?: number) => {
/** 联系人转移 */
const transferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 联系人转移表单 ref
const transfer = () => {
transferFormRef.value?.open('联系人转移', contact.value.id, ContactApi.transferContact)
transferFormRef.value?.open(contact.value.id)
}
/** 获取操作日志 */
@@ -116,6 +116,6 @@ onMounted(async () => {
return
}
contactId.value = params.id as unknown as number
await getContact(contactId.value)
await getContact()
})
</script>