1
This commit is contained in:
parent
d56fc0f50e
commit
cd9cbea7d6
@ -13,6 +13,7 @@ import {
|
|||||||
FormItem,
|
FormItem,
|
||||||
Input,
|
Input,
|
||||||
Modal,
|
Modal,
|
||||||
|
Switch,
|
||||||
message,
|
message,
|
||||||
} from 'antdv-next';
|
} from 'antdv-next';
|
||||||
|
|
||||||
@ -30,6 +31,10 @@ const emit = defineEmits<{
|
|||||||
const saving = ref(false);
|
const saving = ref(false);
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
|
canAddBdLeader: true,
|
||||||
|
canBanUser: true,
|
||||||
|
canGiftProps: true,
|
||||||
|
canUnbanUser: true,
|
||||||
contact: '',
|
contact: '',
|
||||||
id: '',
|
id: '',
|
||||||
regionId: '',
|
regionId: '',
|
||||||
@ -51,6 +56,10 @@ watch(
|
|||||||
form.sysOrigin = props.row?.sysOrigin || props.sysOrigin || 'LIKEI';
|
form.sysOrigin = props.row?.sysOrigin || props.sysOrigin || 'LIKEI';
|
||||||
form.contact = props.row?.contact || '';
|
form.contact = props.row?.contact || '';
|
||||||
form.regionId = String(props.row?.regionId || '');
|
form.regionId = String(props.row?.regionId || '');
|
||||||
|
form.canAddBdLeader = props.row?.canAddBdLeader !== false;
|
||||||
|
form.canGiftProps = props.row?.canGiftProps !== false;
|
||||||
|
form.canBanUser = props.row?.canBanUser !== false;
|
||||||
|
form.canUnbanUser = props.row?.canUnbanUser !== false;
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
@ -67,6 +76,10 @@ async function handleSubmit() {
|
|||||||
saving.value = true;
|
saving.value = true;
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
|
canAddBdLeader: form.canAddBdLeader,
|
||||||
|
canBanUser: form.canBanUser,
|
||||||
|
canGiftProps: form.canGiftProps,
|
||||||
|
canUnbanUser: form.canUnbanUser,
|
||||||
contact: form.contact.trim(),
|
contact: form.contact.trim(),
|
||||||
id: form.id || undefined,
|
id: form.id || undefined,
|
||||||
regionId: form.regionId,
|
regionId: form.regionId,
|
||||||
@ -114,6 +127,42 @@ async function handleSubmit() {
|
|||||||
<FormItem label="联系方式">
|
<FormItem label="联系方式">
|
||||||
<Input v-model:value="form.contact" placeholder="联系方式" />
|
<Input v-model:value="form.contact" placeholder="联系方式" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem label="功能开关">
|
||||||
|
<div class="feature-switches">
|
||||||
|
<label class="feature-switch-row">
|
||||||
|
<span>加BD Leader</span>
|
||||||
|
<Switch v-model:checked="form.canAddBdLeader" />
|
||||||
|
</label>
|
||||||
|
<label class="feature-switch-row">
|
||||||
|
<span>赠送道具</span>
|
||||||
|
<Switch v-model:checked="form.canGiftProps" />
|
||||||
|
</label>
|
||||||
|
<label class="feature-switch-row">
|
||||||
|
<span>封禁用户</span>
|
||||||
|
<Switch v-model:checked="form.canBanUser" />
|
||||||
|
</label>
|
||||||
|
<label class="feature-switch-row">
|
||||||
|
<span>解封用户</span>
|
||||||
|
<Switch v-model:checked="form.canUnbanUser" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.feature-switches {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-switch-row {
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid #e5e7eb;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import {
|
|||||||
Pagination,
|
Pagination,
|
||||||
Space,
|
Space,
|
||||||
Table,
|
Table,
|
||||||
|
Tag,
|
||||||
message,
|
message,
|
||||||
} from 'antdv-next';
|
} from 'antdv-next';
|
||||||
|
|
||||||
@ -55,12 +56,20 @@ const columns = [
|
|||||||
{ dataIndex: 'userProfile', key: 'userProfile', title: '经理', width: 240 },
|
{ dataIndex: 'userProfile', key: 'userProfile', title: '经理', width: 240 },
|
||||||
{ dataIndex: 'regionName', key: 'regionName', title: '区域', width: 140 },
|
{ dataIndex: 'regionName', key: 'regionName', title: '区域', width: 140 },
|
||||||
{ dataIndex: 'contact', key: 'contact', title: '联系方式', width: 180 },
|
{ dataIndex: 'contact', key: 'contact', title: '联系方式', width: 180 },
|
||||||
|
{ dataIndex: 'features', key: 'features', title: '功能开关', width: 280 },
|
||||||
{ dataIndex: 'createUserName', key: 'createUserName', title: '创建人', width: 140 },
|
{ dataIndex: 'createUserName', key: 'createUserName', title: '创建人', width: 140 },
|
||||||
{ dataIndex: 'updateUserName', key: 'updateUserName', title: '修改人', width: 140 },
|
{ dataIndex: 'updateUserName', key: 'updateUserName', title: '修改人', width: 140 },
|
||||||
{ dataIndex: 'createTime', key: 'createTime', title: '创建时间', width: 180 },
|
{ dataIndex: 'createTime', key: 'createTime', title: '创建时间', width: 180 },
|
||||||
{ dataIndex: 'actions', key: 'actions', title: '操作', width: 120 },
|
{ dataIndex: 'actions', key: 'actions', title: '操作', width: 120 },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const managerFeatureSwitches = [
|
||||||
|
{ key: 'canAddBdLeader', label: '加BD Leader' },
|
||||||
|
{ key: 'canGiftProps', label: '赠送道具' },
|
||||||
|
{ key: 'canBanUser', label: '封禁用户' },
|
||||||
|
{ key: 'canUnbanUser', label: '解封用户' },
|
||||||
|
];
|
||||||
|
|
||||||
function hasPermission(code: string) {
|
function hasPermission(code: string) {
|
||||||
const codes = accessStore.accessCodes || [];
|
const codes = accessStore.accessCodes || [];
|
||||||
return codes.length === 0 || codes.includes(code);
|
return codes.length === 0 || codes.includes(code);
|
||||||
@ -75,6 +84,10 @@ function getUserShortId(profile?: Record<string, any> | null) {
|
|||||||
return profile?.actualAccount || profile?.account || profile?.id || '-';
|
return profile?.actualAccount || profile?.account || profile?.id || '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isFeatureEnabled(record: Record<string, any>, key: string) {
|
||||||
|
return record?.[key] !== false;
|
||||||
|
}
|
||||||
|
|
||||||
async function loadData(reset = false) {
|
async function loadData(reset = false) {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
query.cursor = 1;
|
query.cursor = 1;
|
||||||
@ -186,6 +199,17 @@ loadData(true);
|
|||||||
<template v-else-if="column.key === 'contact'">
|
<template v-else-if="column.key === 'contact'">
|
||||||
{{ canEdit ? record.contact || '-' : '-' }}
|
{{ canEdit ? record.contact || '-' : '-' }}
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="column.key === 'features'">
|
||||||
|
<Space wrap :size="[4, 4]">
|
||||||
|
<Tag
|
||||||
|
v-for="item in managerFeatureSwitches"
|
||||||
|
:key="item.key"
|
||||||
|
:color="isFeatureEnabled(record, item.key) ? 'green' : 'red'"
|
||||||
|
>
|
||||||
|
{{ item.label }}:{{ isFeatureEnabled(record, item.key) ? '开' : '关' }}
|
||||||
|
</Tag>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
<template v-else-if="column.key === 'createTime'">
|
<template v-else-if="column.key === 'createTime'">
|
||||||
{{ formatDate(record.createTime) }}
|
{{ formatDate(record.createTime) }}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user