Skip to content

Commit c6192a1

Browse files
YunaiVgitee-org
authored andcommitted
!329 完善团队成员公共组件,crm-客户:集成团队成员
Merge pull request !329 from puhui999/dev-crm
2 parents 8f97155 + f8b56a8 commit c6192a1

File tree

7 files changed

+233
-231
lines changed

7 files changed

+233
-231
lines changed

src/api/crm/permission/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export interface PermissionVO {
66
bizType: number | undefined // Crm 类型
77
bizId: number | undefined // Crm 类型数据编号
88
level: number | undefined // 权限级别
9-
deptName?: string // 部门名称 // 岗位名称数组 TODO @puhui999:数组?
9+
deptName?: string // 部门名称
1010
nickname?: string // 用户昵称
11-
postNames?: string // 岗位名称数组 TODO @puhui999:数组?
11+
postNames?: string[] // 岗位名称数组
1212
createTime?: Date
1313
}
1414

@@ -19,7 +19,7 @@ export const getPermissionList = async (params) => {
1919

2020
// 新增团队成员
2121
export const createPermission = async (data: PermissionVO) => {
22-
return await request.post({ url: `/crm/permission/add`, data })
22+
return await request.post({ url: `/crm/permission/create`, data })
2323
}
2424

2525
// 修改团队成员权限级别

src/utils/dict.ts

Lines changed: 151 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* 数据字典工具类
33
*/
4-
import { useDictStoreWithOut } from '@/store/modules/dict'
5-
import { ElementPlusInfoType } from '@/types/elementPlus'
4+
import {useDictStoreWithOut} from '@/store/modules/dict'
5+
import {ElementPlusInfoType} from '@/types/elementPlus'
66

77
const dictStore = useDictStoreWithOut()
88

@@ -13,51 +13,51 @@ const dictStore = useDictStoreWithOut()
1313
* @returns {*|Array} 数据字典数组
1414
*/
1515
export interface DictDataType {
16-
dictType: string
17-
label: string
18-
value: string | number | boolean
19-
colorType: ElementPlusInfoType | ''
20-
cssClass: string
16+
dictType: string
17+
label: string
18+
value: string | number | boolean
19+
colorType: ElementPlusInfoType | ''
20+
cssClass: string
2121
}
2222

2323
export const getDictOptions = (dictType: string) => {
24-
return dictStore.getDictByType(dictType) || []
24+
return dictStore.getDictByType(dictType) || []
2525
}
2626

2727
export const getIntDictOptions = (dictType: string): DictDataType[] => {
28-
const dictOption: DictDataType[] = []
29-
const dictOptions: DictDataType[] = getDictOptions(dictType)
30-
dictOptions.forEach((dict: DictDataType) => {
31-
dictOption.push({
32-
...dict,
33-
value: parseInt(dict.value + '')
28+
const dictOption: DictDataType[] = []
29+
const dictOptions: DictDataType[] = getDictOptions(dictType)
30+
dictOptions.forEach((dict: DictDataType) => {
31+
dictOption.push({
32+
...dict,
33+
value: parseInt(dict.value + '')
34+
})
3435
})
35-
})
36-
return dictOption
36+
return dictOption
3737
}
3838

3939
export const getStrDictOptions = (dictType: string) => {
40-
const dictOption: DictDataType[] = []
41-
const dictOptions: DictDataType[] = getDictOptions(dictType)
42-
dictOptions.forEach((dict: DictDataType) => {
43-
dictOption.push({
44-
...dict,
45-
value: dict.value + ''
40+
const dictOption: DictDataType[] = []
41+
const dictOptions: DictDataType[] = getDictOptions(dictType)
42+
dictOptions.forEach((dict: DictDataType) => {
43+
dictOption.push({
44+
...dict,
45+
value: dict.value + ''
46+
})
4647
})
47-
})
48-
return dictOption
48+
return dictOption
4949
}
5050

5151
export const getBoolDictOptions = (dictType: string) => {
52-
const dictOption: DictDataType[] = []
53-
const dictOptions: DictDataType[] = getDictOptions(dictType)
54-
dictOptions.forEach((dict: DictDataType) => {
55-
dictOption.push({
56-
...dict,
57-
value: dict.value + '' === 'true'
52+
const dictOption: DictDataType[] = []
53+
const dictOptions: DictDataType[] = getDictOptions(dictType)
54+
dictOptions.forEach((dict: DictDataType) => {
55+
dictOption.push({
56+
...dict,
57+
value: dict.value + '' === 'true'
58+
})
5859
})
59-
})
60-
return dictOption
60+
return dictOption
6161
}
6262

6363
/**
@@ -67,12 +67,12 @@ export const getBoolDictOptions = (dictType: string) => {
6767
* @return DictDataType 字典对象
6868
*/
6969
export const getDictObj = (dictType: string, value: any): DictDataType | undefined => {
70-
const dictOptions: DictDataType[] = getDictOptions(dictType)
71-
for (const dict of dictOptions) {
72-
if (dict.value === value + '') {
73-
return dict
70+
const dictOptions: DictDataType[] = getDictOptions(dictType)
71+
for (const dict of dictOptions) {
72+
if (dict.value === value + '') {
73+
return dict
74+
}
7475
}
75-
}
7676
}
7777

7878
/**
@@ -83,117 +83,121 @@ export const getDictObj = (dictType: string, value: any): DictDataType | undefin
8383
* @return 字典名称
8484
*/
8585
export const getDictLabel = (dictType: string, value: any): string => {
86-
const dictOptions: DictDataType[] = getDictOptions(dictType)
87-
const dictLabel = ref('')
88-
dictOptions.forEach((dict: DictDataType) => {
89-
if (dict.value === value + '') {
90-
dictLabel.value = dict.label
91-
}
92-
})
93-
return dictLabel.value
86+
const dictOptions: DictDataType[] = getDictOptions(dictType)
87+
const dictLabel = ref('')
88+
dictOptions.forEach((dict: DictDataType) => {
89+
if (dict.value === value + '') {
90+
dictLabel.value = dict.label
91+
}
92+
})
93+
return dictLabel.value
9494
}
9595

9696
export enum DICT_TYPE {
97-
USER_TYPE = 'user_type',
98-
COMMON_STATUS = 'common_status',
99-
SYSTEM_TENANT_PACKAGE_ID = 'system_tenant_package_id',
100-
TERMINAL = 'terminal', // 终端
101-
102-
// ========== SYSTEM 模块 ==========
103-
SYSTEM_USER_SEX = 'system_user_sex',
104-
SYSTEM_MENU_TYPE = 'system_menu_type',
105-
SYSTEM_ROLE_TYPE = 'system_role_type',
106-
SYSTEM_DATA_SCOPE = 'system_data_scope',
107-
SYSTEM_NOTICE_TYPE = 'system_notice_type',
108-
SYSTEM_OPERATE_TYPE = 'system_operate_type',
109-
SYSTEM_LOGIN_TYPE = 'system_login_type',
110-
SYSTEM_LOGIN_RESULT = 'system_login_result',
111-
SYSTEM_SMS_CHANNEL_CODE = 'system_sms_channel_code',
112-
SYSTEM_SMS_TEMPLATE_TYPE = 'system_sms_template_type',
113-
SYSTEM_SMS_SEND_STATUS = 'system_sms_send_status',
114-
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
115-
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
116-
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
117-
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
118-
SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
119-
SYSTEM_SOCIAL_TYPE = 'system_social_type',
120-
121-
// ========== INFRA 模块 ==========
122-
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
123-
INFRA_JOB_STATUS = 'infra_job_status',
124-
INFRA_JOB_LOG_STATUS = 'infra_job_log_status',
125-
INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status',
126-
INFRA_CONFIG_TYPE = 'infra_config_type',
127-
INFRA_CODEGEN_TEMPLATE_TYPE = 'infra_codegen_template_type',
128-
INFRA_CODEGEN_FRONT_TYPE = 'infra_codegen_front_type',
129-
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
130-
INFRA_FILE_STORAGE = 'infra_file_storage',
131-
132-
// ========== BPM 模块 ==========
133-
BPM_MODEL_CATEGORY = 'bpm_model_category',
134-
BPM_MODEL_FORM_TYPE = 'bpm_model_form_type',
135-
BPM_TASK_ASSIGN_RULE_TYPE = 'bpm_task_assign_rule_type',
136-
BPM_PROCESS_INSTANCE_STATUS = 'bpm_process_instance_status',
137-
BPM_PROCESS_INSTANCE_RESULT = 'bpm_process_instance_result',
138-
BPM_TASK_ASSIGN_SCRIPT = 'bpm_task_assign_script',
139-
BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type',
140-
141-
// ========== PAY 模块 ==========
142-
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
143-
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
144-
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
145-
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
146-
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态
147-
PAY_TRANSFER_STATUS = 'pay_transfer_status', // 转账订单状态
148-
PAY_TRANSFER_TYPE = 'pay_transfer_type', // 转账订单状态
149-
150-
// ========== MP 模块 ==========
151-
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
152-
MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型
153-
154-
// ========== MALL - 会员模块 ==========
155-
MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型
156-
MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型
157-
158-
// ========== MALL - 商品模块 ==========
159-
PRODUCT_UNIT = 'product_unit', // 商品单位
160-
PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态
161-
PROMOTION_TYPE_ENUM = 'promotion_type_enum', // 营销类型枚举
162-
163-
// ========== MALL - 交易模块 ==========
164-
EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式
165-
TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态
166-
TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式
167-
TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型
168-
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
169-
TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态
170-
TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态
171-
TRADE_DELIVERY_TYPE = 'trade_delivery_type', // 配送方式
172-
BROKERAGE_ENABLED_CONDITION = 'brokerage_enabled_condition', // 分佣模式
173-
BROKERAGE_BIND_MODE = 'brokerage_bind_mode', // 分销关系绑定模式
174-
BROKERAGE_BANK_NAME = 'brokerage_bank_name', // 佣金提现银行
175-
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金提现类型
176-
BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型
177-
BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态
178-
BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态
179-
180-
// ========== MALL - 营销模块 ==========
181-
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
182-
PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围
183-
PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型
184-
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
185-
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
186-
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
187-
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
188-
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
189-
PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态
190-
PROMOTION_BANNER_POSITION = 'promotion_banner_position', // banner 定位
191-
192-
// ========== CRM - 客户管理模块 ==========
193-
CRM_RECEIVABLE_CHECK_STATUS = 'crm_receivable_check_status',
194-
CRM_RETURN_TYPE = 'crm_return_type',
195-
CRM_CUSTOMER_INDUSTRY = 'crm_customer_industry',
196-
CRM_CUSTOMER_LEVEL = 'crm_customer_level',
197-
CRM_CUSTOMER_SOURCE = 'crm_customer_source',
198-
CRM_PRODUCT_STATUS = 'crm_product_status'
97+
USER_TYPE = 'user_type',
98+
COMMON_STATUS = 'common_status',
99+
SYSTEM_TENANT_PACKAGE_ID = 'system_tenant_package_id',
100+
TERMINAL = 'terminal', // 终端
101+
102+
// ========== SYSTEM 模块 ==========
103+
SYSTEM_USER_SEX = 'system_user_sex',
104+
SYSTEM_MENU_TYPE = 'system_menu_type',
105+
SYSTEM_ROLE_TYPE = 'system_role_type',
106+
SYSTEM_DATA_SCOPE = 'system_data_scope',
107+
SYSTEM_NOTICE_TYPE = 'system_notice_type',
108+
SYSTEM_OPERATE_TYPE = 'system_operate_type',
109+
SYSTEM_LOGIN_TYPE = 'system_login_type',
110+
SYSTEM_LOGIN_RESULT = 'system_login_result',
111+
SYSTEM_SMS_CHANNEL_CODE = 'system_sms_channel_code',
112+
SYSTEM_SMS_TEMPLATE_TYPE = 'system_sms_template_type',
113+
SYSTEM_SMS_SEND_STATUS = 'system_sms_send_status',
114+
SYSTEM_SMS_RECEIVE_STATUS = 'system_sms_receive_status',
115+
SYSTEM_ERROR_CODE_TYPE = 'system_error_code_type',
116+
SYSTEM_OAUTH2_GRANT_TYPE = 'system_oauth2_grant_type',
117+
SYSTEM_MAIL_SEND_STATUS = 'system_mail_send_status',
118+
SYSTEM_NOTIFY_TEMPLATE_TYPE = 'system_notify_template_type',
119+
SYSTEM_SOCIAL_TYPE = 'system_social_type',
120+
121+
// ========== INFRA 模块 ==========
122+
INFRA_BOOLEAN_STRING = 'infra_boolean_string',
123+
INFRA_JOB_STATUS = 'infra_job_status',
124+
INFRA_JOB_LOG_STATUS = 'infra_job_log_status',
125+
INFRA_API_ERROR_LOG_PROCESS_STATUS = 'infra_api_error_log_process_status',
126+
INFRA_CONFIG_TYPE = 'infra_config_type',
127+
INFRA_CODEGEN_TEMPLATE_TYPE = 'infra_codegen_template_type',
128+
INFRA_CODEGEN_FRONT_TYPE = 'infra_codegen_front_type',
129+
INFRA_CODEGEN_SCENE = 'infra_codegen_scene',
130+
INFRA_FILE_STORAGE = 'infra_file_storage',
131+
132+
// ========== BPM 模块 ==========
133+
BPM_MODEL_CATEGORY = 'bpm_model_category',
134+
BPM_MODEL_FORM_TYPE = 'bpm_model_form_type',
135+
BPM_TASK_ASSIGN_RULE_TYPE = 'bpm_task_assign_rule_type',
136+
BPM_PROCESS_INSTANCE_STATUS = 'bpm_process_instance_status',
137+
BPM_PROCESS_INSTANCE_RESULT = 'bpm_process_instance_result',
138+
BPM_TASK_ASSIGN_SCRIPT = 'bpm_task_assign_script',
139+
BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type',
140+
141+
// ========== PAY 模块 ==========
142+
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型
143+
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
144+
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
145+
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态
146+
PAY_NOTIFY_TYPE = 'pay_notify_type', // 商户支付回调状态
147+
PAY_TRANSFER_STATUS = 'pay_transfer_status', // 转账订单状态
148+
PAY_TRANSFER_TYPE = 'pay_transfer_type', // 转账订单状态
149+
150+
// ========== MP 模块 ==========
151+
MP_AUTO_REPLY_REQUEST_MATCH = 'mp_auto_reply_request_match', // 自动回复请求匹配类型
152+
MP_MESSAGE_TYPE = 'mp_message_type', // 消息类型
153+
154+
// ========== MALL - 会员模块 ==========
155+
MEMBER_POINT_BIZ_TYPE = 'member_point_biz_type', // 积分的业务类型
156+
MEMBER_EXPERIENCE_BIZ_TYPE = 'member_experience_biz_type', // 会员经验业务类型
157+
158+
// ========== MALL - 商品模块 ==========
159+
PRODUCT_UNIT = 'product_unit', // 商品单位
160+
PRODUCT_SPU_STATUS = 'product_spu_status', //商品状态
161+
PROMOTION_TYPE_ENUM = 'promotion_type_enum', // 营销类型枚举
162+
163+
// ========== MALL - 交易模块 ==========
164+
EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式
165+
TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态
166+
TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式
167+
TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型
168+
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
169+
TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态
170+
TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态
171+
TRADE_DELIVERY_TYPE = 'trade_delivery_type', // 配送方式
172+
BROKERAGE_ENABLED_CONDITION = 'brokerage_enabled_condition', // 分佣模式
173+
BROKERAGE_BIND_MODE = 'brokerage_bind_mode', // 分销关系绑定模式
174+
BROKERAGE_BANK_NAME = 'brokerage_bank_name', // 佣金提现银行
175+
BROKERAGE_WITHDRAW_TYPE = 'brokerage_withdraw_type', // 佣金提现类型
176+
BROKERAGE_RECORD_BIZ_TYPE = 'brokerage_record_biz_type', // 佣金业务类型
177+
BROKERAGE_RECORD_STATUS = 'brokerage_record_status', // 佣金状态
178+
BROKERAGE_WITHDRAW_STATUS = 'brokerage_withdraw_status', // 佣金提现状态
179+
180+
// ========== MALL - 营销模块 ==========
181+
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
182+
PROMOTION_PRODUCT_SCOPE = 'promotion_product_scope', // 营销的商品范围
183+
PROMOTION_COUPON_TEMPLATE_VALIDITY_TYPE = 'promotion_coupon_template_validity_type', // 优惠劵模板的有限期类型
184+
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
185+
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
186+
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
187+
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举
188+
PROMOTION_BARGAIN_RECORD_STATUS = 'promotion_bargain_record_status', // 砍价记录的状态
189+
PROMOTION_COMBINATION_RECORD_STATUS = 'promotion_combination_record_status', // 拼团记录的状态
190+
PROMOTION_BANNER_POSITION = 'promotion_banner_position', // banner 定位
191+
192+
// ========== CRM - 客户管理模块 ==========
193+
CRM_RECEIVABLE_CHECK_STATUS = 'crm_receivable_check_status',
194+
CRM_RETURN_TYPE = 'crm_return_type',
195+
CRM_CUSTOMER_INDUSTRY = 'crm_customer_industry',
196+
CRM_CUSTOMER_LEVEL = 'crm_customer_level',
197+
CRM_CUSTOMER_SOURCE = 'crm_customer_source',
198+
CRM_PRODUCT_STATUS = 'crm_product_status',
199+
200+
// ========== CRM - 数据权限模块 ==========
201+
CRM_BIZ_TYPE = 'crm_biz_type', // 数据模块类型
202+
CRM_PERMISSION_LEVEL = 'crm_permission_level' // 用户数据权限类型
199203
}

src/views/crm/components/CrmPermissionForm.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
</el-form-item>
2020
<el-form-item label="权限级别" prop="level">
2121
<el-radio-group v-model="formData.level">
22-
<!-- TODO @puhui999:搞个字典配置?然后这里 remove 掉负责人 -->
23-
<el-radio :label="CrmPermissionLevelEnum.READ">只读</el-radio>
24-
<el-radio :label="CrmPermissionLevelEnum.WRITE">读写</el-radio>
22+
<template
23+
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_PERMISSION_LEVEL)"
24+
:key="dict.value"
25+
>
26+
<el-radio v-if="dict.value != CrmPermissionLevelEnum.OWNER" :label="dict.value">
27+
{{ dict.label }}
28+
</el-radio>
29+
</template>
2530
</el-radio-group>
2631
</el-form-item>
2732
</el-form>
@@ -34,7 +39,8 @@
3439
<script lang="ts" setup>
3540
import * as UserApi from '@/api/system/user'
3641
import * as PermissionApi from '@/api/crm/permission'
37-
import { CrmPermissionLevelEnum } from './index'
42+
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
43+
import { CrmPermissionLevelEnum } from '@/views/crm/components/index'
3844
3945
defineOptions({ name: 'CrmPermissionForm' })
4046

0 commit comments

Comments
 (0)