feat:【antd】【crm】团队成员的代码实现
This commit is contained in:
@@ -34,6 +34,7 @@ function getUserTypeColor(userType: number) {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<!-- TODO @xingyu:有没可能美化下? -->
|
||||||
<Timeline>
|
<Timeline>
|
||||||
<Timeline.Item
|
<Timeline.Item
|
||||||
v-for="log in logList"
|
v-for="log in logList"
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 已选择的商机 */
|
|
||||||
const checkedRows = ref<CrmBusinessApi.Business[]>([]);
|
const checkedRows = ref<CrmBusinessApi.Business[]>([]);
|
||||||
function setCheckedRows({ records }: { records: CrmBusinessApi.Business[] }) {
|
function setCheckedRows({ records }: { records: CrmBusinessApi.Business[] }) {
|
||||||
checkedRows.value = records;
|
checkedRows.value = records;
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ const [DetailListModal, detailListModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 已选择的商机 */
|
|
||||||
const checkedRows = ref<CrmBusinessApi.Business[]>([]);
|
const checkedRows = ref<CrmBusinessApi.Business[]>([]);
|
||||||
function setCheckedRows({ records }: { records: CrmBusinessApi.Business[] }) {
|
function setCheckedRows({ records }: { records: CrmBusinessApi.Business[] }) {
|
||||||
checkedRows.value = records;
|
checkedRows.value = records;
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export { default as PermissionList } from './modules/permission-list.vue';
|
export { default as PermissionList } from './modules/list.vue';
|
||||||
export { default as TransferForm } from './modules/transfer-form.vue';
|
export { default as TransferForm } from './modules/transfer-form.vue';
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
|
||||||
import { useGridColumns } from './data';
|
import { useGridColumns } from './data';
|
||||||
import Form from './permission-form.vue';
|
import Form from './form.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
bizId: number; // 模块数据编号
|
bizId: number; // 模块数据编号
|
||||||
@@ -38,13 +38,14 @@ const [FormModal, formModalApi] = useVbenModal({
|
|||||||
destroyOnClose: true,
|
destroyOnClose: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 校验负责人权限和编辑权限
|
const userStore = useUserStore();
|
||||||
const validateOwnerUser = ref(false);
|
|
||||||
const validateWrite = ref(false);
|
const validateOwnerUser = ref(false); // 负责人权限
|
||||||
const isPool = ref(false);
|
const validateWrite = ref(false); // 编辑权限
|
||||||
|
const isPool = ref(false); // 是否是公海
|
||||||
|
|
||||||
/** 刷新表格 */
|
/** 刷新表格 */
|
||||||
function onRefresh() {
|
function handleRefresh() {
|
||||||
gridApi.query();
|
gridApi.query();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ function setCheckedRows({
|
|||||||
checkedRows.value = records;
|
checkedRows.value = records;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 新建团队成员 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi
|
formModalApi
|
||||||
.setData({
|
.setData({
|
||||||
@@ -71,6 +73,7 @@ function handleCreate() {
|
|||||||
.open();
|
.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 编辑团队成员 */
|
||||||
function handleEdit() {
|
function handleEdit() {
|
||||||
if (checkedRows.value.length === 0) {
|
if (checkedRows.value.length === 0) {
|
||||||
message.error('请先选择团队成员后操作!');
|
message.error('请先选择团队成员后操作!');
|
||||||
@@ -90,6 +93,7 @@ function handleEdit() {
|
|||||||
.open();
|
.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 删除团队成员 */
|
||||||
function handleDelete() {
|
function handleDelete() {
|
||||||
if (checkedRows.value.length === 0) {
|
if (checkedRows.value.length === 0) {
|
||||||
message.error('请先选择团队成员后操作!');
|
message.error('请先选择团队成员后操作!');
|
||||||
@@ -106,7 +110,7 @@ function handleDelete() {
|
|||||||
if (res) {
|
if (res) {
|
||||||
// 提示并返回成功
|
// 提示并返回成功
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
onRefresh();
|
handleRefresh();
|
||||||
resolve(true);
|
resolve(true);
|
||||||
} else {
|
} else {
|
||||||
reject(new Error('移出失败'));
|
reject(new Error('移出失败'));
|
||||||
@@ -118,8 +122,7 @@ function handleDelete() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const userStore = useUserStore();
|
/** 退出团队 */
|
||||||
|
|
||||||
async function handleQuit() {
|
async function handleQuit() {
|
||||||
const permission = gridApi.grid
|
const permission = gridApi.grid
|
||||||
.getData()
|
.getData()
|
||||||
@@ -208,6 +211,7 @@ watch(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
// 特殊:没有成员的情况下,说明没有负责人,是公海
|
||||||
isPool.value = true;
|
isPool.value = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -219,7 +223,7 @@ watch(
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="handleRefresh" />
|
||||||
<Grid>
|
<Grid>
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<TableAction
|
<TableAction
|
||||||
@@ -237,6 +241,7 @@ watch(
|
|||||||
icon: ACTION_ICON.EDIT,
|
icon: ACTION_ICON.EDIT,
|
||||||
ifShow: validateOwnerUser,
|
ifShow: validateOwnerUser,
|
||||||
onClick: handleEdit,
|
onClick: handleEdit,
|
||||||
|
disabled: checkedRows.length === 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: $t('common.delete'),
|
label: $t('common.delete'),
|
||||||
@@ -245,6 +250,7 @@ watch(
|
|||||||
icon: ACTION_ICON.DELETE,
|
icon: ACTION_ICON.DELETE,
|
||||||
ifShow: validateOwnerUser,
|
ifShow: validateOwnerUser,
|
||||||
onClick: handleDelete,
|
onClick: handleDelete,
|
||||||
|
disabled: checkedRows.length === 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '退出团队',
|
label: '退出团队',
|
||||||
@@ -99,7 +99,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
},
|
},
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
formApi.resetForm();
|
await formApi.resetForm();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
@@ -108,7 +108,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bizType.value = data.bizType;
|
bizType.value = data.bizType;
|
||||||
formApi.setFieldValue('id', data.bizType);
|
await formApi.setFieldValue('id', data.bizType);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user