crm:code review 成员

This commit is contained in:
YunaiV 2023-11-25 10:42:44 +08:00
parent 54897b6d1b
commit eb97447bb7
2 changed files with 153 additions and 159 deletions

View File

@ -1,8 +1,8 @@
/** /**
* *
*/ */
import {useDictStoreWithOut} from '@/store/modules/dict' import { useDictStoreWithOut } from '@/store/modules/dict'
import {ElementPlusInfoType} from '@/types/elementPlus' import { ElementPlusInfoType } from '@/types/elementPlus'
const dictStore = useDictStoreWithOut() const dictStore = useDictStoreWithOut()

View File

@ -5,7 +5,7 @@
<Icon class="mr-5px" icon="ep:plus" /> <Icon class="mr-5px" icon="ep:plus" />
新增 新增
</el-button> </el-button>
<el-button @click="handleEdit"> <el-button @click="handleUpdate">
<Icon class="mr-5px" icon="ep:edit" /> <Icon class="mr-5px" icon="ep:edit" />
编辑 编辑
</el-button> </el-button>
@ -35,7 +35,9 @@
</el-table-column> </el-table-column>
<el-table-column :formatter="dateFormatter" align="center" label="加入时间" prop="createTime" /> <el-table-column :formatter="dateFormatter" align="center" label="加入时间" prop="createTime" />
</el-table> </el-table>
<CrmPermissionForm ref="permissionFormRef" @success="getList" />
<!-- 表单弹窗添加/修改 -->
<CrmPermissionForm ref="formRef" @success="getList" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
@ -75,22 +77,18 @@ const handleSelectionChange = (val: PermissionApi.PermissionVO[]) => {
multipleSelection.value = val multipleSelection.value = val
} }
const permissionFormRef = ref<InstanceType<typeof CrmPermissionForm>>() // Ref /** 编辑团队成员 */
/** const formRef = ref<InstanceType<typeof CrmPermissionForm>>() // Ref
* 编辑团队成员 const handleUpdate = () => {
*/
const handleEdit = () => {
if (multipleSelection.value?.length === 0) { if (multipleSelection.value?.length === 0) {
message.warning('请先选择团队成员后操作!') message.warning('请先选择团队成员后操作!')
return return
} }
const ids = multipleSelection.value?.map((item) => item.id) const ids = multipleSelection.value?.map((item) => item.id)
permissionFormRef.value?.open('update', props.bizType, props.bizId, ids) formRef.value?.open('update', props.bizType, props.bizId, ids)
} }
/** /** 移除团队成员 */
* 移除团队成员
*/
const handleDelete = async () => { const handleDelete = async () => {
if (multipleSelection.value?.length === 0) { if (multipleSelection.value?.length === 0) {
message.warning('请先选择团队成员后操作!') message.warning('请先选择团队成员后操作!')
@ -105,17 +103,13 @@ const handleDelete = async () => {
}) })
} }
/** /** 添加团队成员 */
* 添加团队成员
*/
const openForm = () => { const openForm = () => {
permissionFormRef.value?.open('create', props.bizType, props.bizId) formRef.value?.open('create', props.bizType, props.bizId)
} }
/** 退出团队 */
const userStore = useUserStoreWithOut() // const userStore = useUserStoreWithOut() //
/**
* 退出团队
*/
const handleQuit = async () => { const handleQuit = async () => {
const permission = list.value.find( const permission = list.value.find(
(item) => item.userId === userStore.getUser.id && item.level === CrmPermissionLevelEnum.OWNER (item) => item.userId === userStore.getUser.id && item.level === CrmPermissionLevelEnum.OWNER