feat: 分组管理
This commit is contained in:
@ -48,3 +48,24 @@ export const deleteMediaAccounts = (id: string) => {
|
||||
export const getTemplateUrl = (params = {}) => {
|
||||
return Http.get('/v1/media-accounts/template', params);
|
||||
};
|
||||
|
||||
// 媒体账号分组-分页
|
||||
export const getGroupList = (params = {}) => {
|
||||
return Http.get('/v1/media-account-groups/list', params);
|
||||
};
|
||||
|
||||
// 媒体账号分组 -添加
|
||||
export const postAccountGroups = (params = {}) => {
|
||||
return Http.post('/v1/media-account-groups', params);
|
||||
};
|
||||
|
||||
// 媒体账号分组-编辑
|
||||
export const putGroupList = (params = {}) => {
|
||||
const { id, ...rest } = params as { id: string; [key: string]: any };
|
||||
return Http.put(`/v1/media-account-groups/${id}`, rest);
|
||||
};
|
||||
|
||||
// 媒体账号分组-删除
|
||||
export const deleteGroup = (id: string) => {
|
||||
return Http.delete(`/v1/media-account-groups/${id}`);
|
||||
};
|
||||
|
||||
BIN
src/assets/img/media-account/icon-empty.png
Normal file
BIN
src/assets/img/media-account/icon-empty.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
48
src/views/property-marketing/component.scss
Normal file
48
src/views/property-marketing/component.scss
Normal file
@ -0,0 +1,48 @@
|
||||
.arco-input-wrapper,
|
||||
.arco-select-view-single,
|
||||
.arco-select-view-multiple {
|
||||
border-radius: 4px;
|
||||
border-color: #d7d7d9;
|
||||
background-color: #fff;
|
||||
&:focus-within,
|
||||
&.arco-input-focus {
|
||||
background-color: var(--color-bg-2);
|
||||
border-color: rgb(var(--primary-6));
|
||||
box-shadow: 0 0 0 0 var(--color-primary-light-2);
|
||||
}
|
||||
}
|
||||
.arco-modal {
|
||||
.arco-modal-header {
|
||||
border-bottom: none;
|
||||
height: 56px;
|
||||
padding: 22px 24px 16px 24px;
|
||||
.arco-modal-title {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.arco-modal-body {
|
||||
padding: 24px 24px 20px;
|
||||
.arco-form-item {
|
||||
margin-bottom: 16px;
|
||||
.arco-form-item-label {
|
||||
color: var(--Text-1, #211f24);
|
||||
font-family: 'Alibaba PuHuiTi';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 22px; /* 157.143% */
|
||||
}
|
||||
}
|
||||
.cancel-btn {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--BG-500, #b1b2b5);
|
||||
background: var(--BG-white, #fff);
|
||||
}
|
||||
}
|
||||
|
||||
.arco-modal-footer {
|
||||
border-top: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
@ -247,7 +247,7 @@ async function onSubmit() {
|
||||
formRef.value.validate(async (errors) => {
|
||||
if (!errors) {
|
||||
const _fn = id.value ? putMediaAccounts : postMediaAccounts;
|
||||
const _params = id.value ? { id: id.value } : form;
|
||||
const _params = id.value ? { id: id.value, ...form.value } : form;
|
||||
const { code } = await _fn(_params);
|
||||
if (code === 200) {
|
||||
AMessage.success(isEdit.value ? '修改成功' : '生成授权码成功');
|
||||
|
||||
@ -1,39 +1,10 @@
|
||||
@import "@/views/property-marketing/component.scss";
|
||||
.add-account-modal {
|
||||
border-radius: 8px;
|
||||
.arco-input-wrapper,
|
||||
.arco-select-view-single,
|
||||
.arco-select-view-multiple {
|
||||
border-radius: 4px;
|
||||
border-color: #d7d7d9;
|
||||
background-color: #fff;
|
||||
&:focus-within,
|
||||
&.arco-input-focus {
|
||||
background-color: var(--color-bg-2);
|
||||
border-color: rgb(var(--primary-6));
|
||||
box-shadow: 0 0 0 0 var(--color-primary-light-2);
|
||||
}
|
||||
}
|
||||
.w-240px {
|
||||
width: 240px !important;
|
||||
}
|
||||
.arco-modal-header {
|
||||
border-bottom: none;
|
||||
height: 56px;
|
||||
padding: 22px 24px 16px 24px;
|
||||
.arco-modal-title {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
.arco-modal-body {
|
||||
padding: 24px 24px 20px;
|
||||
.arco-form-item {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.cancel-btn {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--BG-500, #b1b2b5);
|
||||
background: var(--BG-white, #fff);
|
||||
}
|
||||
.upload-block {
|
||||
width: 100%;
|
||||
.dt {
|
||||
@ -89,8 +60,4 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.arco-modal-footer {
|
||||
border-top: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-26 11:44:17
|
||||
-->
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
:title="isEdit ? '编辑分组' : '添加新分组'"
|
||||
modal-class="account-manage-modal"
|
||||
width="400px"
|
||||
:footer="false"
|
||||
@close="onClose"
|
||||
>
|
||||
<a-form ref="formRef" :model="form" :rules="rules" layout="horizontal" auto-label-width>
|
||||
<a-form-item :label="isEdit ? '分组名称' : '新分组名称'" field="name" required>
|
||||
<a-input v-model="form.name" placeholder="请输入…" />
|
||||
</a-form-item>
|
||||
<div class="text-right">
|
||||
<a-button class="cancel-btn" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" class="ml-16px" @click="onSubmit">确认</a-button>
|
||||
</div>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, nextTick } from 'vue';
|
||||
import { postAccountGroups, putGroupList } from '@/api/all/propertyMarketing';
|
||||
|
||||
const emits = defineEmits(['success', 'close']);
|
||||
|
||||
const visible = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const formRef = ref();
|
||||
const form = ref({ name: '' });
|
||||
const groupId = ref('');
|
||||
|
||||
const rules = {
|
||||
name: [{ required: true, message: '请输入分组名称' }],
|
||||
};
|
||||
|
||||
function resetForm() {
|
||||
nextTick(() => {
|
||||
formRef.value?.clearValidate();
|
||||
});
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
visible.value = false;
|
||||
form.value.name = '';
|
||||
groupId.value = '';
|
||||
isEdit.value = false;
|
||||
resetForm();
|
||||
}
|
||||
|
||||
const open = (record = {}) => {
|
||||
const { id = '', name = '' } = record;
|
||||
groupId.value = id;
|
||||
isEdit.value = !!id;
|
||||
form.value.name = name;
|
||||
visible.value = true;
|
||||
};
|
||||
|
||||
async function onSubmit() {
|
||||
formRef.value.validate(async (errors) => {
|
||||
if (!errors) {
|
||||
const _fn = isEdit.value ? putGroupList : postAccountGroups;
|
||||
const _params = isEdit.value ? { id: groupId.value, ...form.value } : form.value;
|
||||
const { code } = await _fn(_params);
|
||||
if (code === 200) {
|
||||
AMessage.success(isEdit.value ? '编辑成功' : '添加成功');
|
||||
emits('success');
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
@ -0,0 +1,63 @@
|
||||
<!--
|
||||
* @Author: RenXiaoDong
|
||||
* @Date: 2025-06-26 11:45:05
|
||||
-->
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
title="删除分组"
|
||||
width="400px"
|
||||
:footer="false"
|
||||
modal-class="account-manage-modal"
|
||||
@close="onClose"
|
||||
>
|
||||
<div class="flex items-center mb-24px">
|
||||
<img :src="icon1" width="20" height="20" class="mr-12px" />
|
||||
<span>确认删除"{{ groupName }}"这个分组吗?</span>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
<a-button class="cancel-btn" size="large" @click="onClose">取消</a-button>
|
||||
<a-button type="primary" class="ml-16px danger-btn" status="danger" size="large" @click="onDelete"
|
||||
>确认删除</a-button
|
||||
>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { deleteGroup } from '@/api/all/propertyMarketing';
|
||||
import icon1 from '@/assets/img/media-account/icon-warn-1.png';
|
||||
|
||||
const emits = defineEmits(['success', 'close']);
|
||||
|
||||
const visible = ref(false);
|
||||
const groupId = ref('');
|
||||
const groupName = ref('');
|
||||
|
||||
function onClose() {
|
||||
visible.value = false;
|
||||
groupId.value = '';
|
||||
groupName.value = '';
|
||||
emits('close');
|
||||
}
|
||||
|
||||
const open = (record) => {
|
||||
const { id = '', name = '' } = record;
|
||||
groupId.value = id;
|
||||
groupName.value = name;
|
||||
|
||||
visible.value = true;
|
||||
};
|
||||
|
||||
async function onDelete() {
|
||||
const { code } = await deleteGroup(groupId.value);
|
||||
if (code === 200) {
|
||||
AMessage.success('删除成功');
|
||||
emits('success');
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
@ -5,33 +5,179 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
width="800px"
|
||||
width="900px"
|
||||
modal-class="account-manage-modal"
|
||||
:footer="false"
|
||||
title="分组管理"
|
||||
:mask-closable="false"
|
||||
@close="close"
|
||||
>
|
||||
<template #title> 分组管理 </template>
|
||||
<template #footer> </template>
|
||||
<template v-if="!list.length">
|
||||
<div class="flex items-center justify-center flex-col">
|
||||
<div class="w-120px h-120px flex items-center justify-center mb-32px">
|
||||
<img :src="icon2" width="106" height="72" />
|
||||
</div>
|
||||
<span class="s1 mb-16px">暂无分组</span>
|
||||
<a-button type="primary" class="mb-16px" size="medium" @click="openAdd"
|
||||
><template #icon>
|
||||
<img :src="icon3" width="16" height="16" />
|
||||
</template>
|
||||
<template #default>去添加</template>
|
||||
</a-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<a-button type="primary" class="mb-16px" size="medium" @click="openAdd"
|
||||
><template #icon>
|
||||
<img :src="icon3" width="16" height="16" />
|
||||
</template>
|
||||
<template #default>添加新分组</template>
|
||||
</a-button>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data="list"
|
||||
row-key="id"
|
||||
:loading="loading"
|
||||
:scroll="{ y: 500 }"
|
||||
:pagination="false"
|
||||
@change="onTableChange"
|
||||
>
|
||||
<template #action="{ record }">
|
||||
<div class="flex items-center">
|
||||
<img :src="icon1" width="16" height="16" class="mr-8px cursor-pointer" @click="openDelete(record)" />
|
||||
<a-button type="primary" @click="openEdit(record)">编辑</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</a-table>
|
||||
<div class="pagination-box">
|
||||
<a-pagination
|
||||
:total="pageInfo.total"
|
||||
size="mini"
|
||||
show-total
|
||||
show-jumper
|
||||
show-page-size
|
||||
:current="pageInfo.page"
|
||||
:page-size="pageInfo.pageSize"
|
||||
@change="onPageChange"
|
||||
@page-size-change="onPageSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<AddGroup ref="addGroupRef" @success="getData" />
|
||||
<DeleteGroup ref="deleteGroupRef" @success="getData" />
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineExpose } from 'vue';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { getGroupList } from '@/api/all/propertyMarketing';
|
||||
import AddGroup from './add-group.vue';
|
||||
import DeleteGroup from './delete-group.vue';
|
||||
|
||||
import icon1 from '@/assets/img/media-account/icon-delete.png';
|
||||
import icon2 from '@/assets/img/media-account/icon-empty.png';
|
||||
import icon3 from '@/assets/img/media-account/icon-add.png';
|
||||
|
||||
const visible = ref(false);
|
||||
const open = () => {
|
||||
visible.value = true;
|
||||
};
|
||||
const close = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
const handleOk = () => {
|
||||
console.log('handleOk');
|
||||
};
|
||||
defineExpose({
|
||||
open,
|
||||
const isEdit = ref(false);
|
||||
const addGroupRef = ref(null);
|
||||
const deleteGroupRef = ref(null);
|
||||
|
||||
const currentGroup = ref(null);
|
||||
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
const pageInfo = reactive({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const sortInfo = ref({
|
||||
field: '',
|
||||
direction: '',
|
||||
});
|
||||
|
||||
const columns = [
|
||||
{ title: '分组名称', dataIndex: 'name' },
|
||||
{
|
||||
title: '创建人',
|
||||
dataIndex: 'creator',
|
||||
render: ({ record }) => record.creator?.name || '-',
|
||||
},
|
||||
{
|
||||
title: '创建日期',
|
||||
dataIndex: 'created_at',
|
||||
width: 160,
|
||||
sortable: {
|
||||
sortDirections: ['ascend', 'descend'],
|
||||
},
|
||||
},
|
||||
{ title: '操作', slotName: 'action', align: 'center', width: 120 },
|
||||
];
|
||||
|
||||
function open() {
|
||||
visible.value = true;
|
||||
getData();
|
||||
}
|
||||
|
||||
function openAdd() {
|
||||
addGroupRef.value.open();
|
||||
}
|
||||
|
||||
function openEdit(record) {
|
||||
addGroupRef.value.open(record);
|
||||
}
|
||||
|
||||
function openDelete(record) {
|
||||
deleteGroupRef.value.open(record);
|
||||
}
|
||||
|
||||
async function getData() {
|
||||
try {
|
||||
loading.value = true;
|
||||
const { page, pageSize } = pageInfo;
|
||||
const params = {
|
||||
page,
|
||||
pageSize,
|
||||
};
|
||||
if (sortInfo.value.field && sortInfo.value.direction) {
|
||||
params.orderField = sortInfo.value.field;
|
||||
params.orderType = sortInfo.value.direction === 'ascend' ? 'asc' : 'desc';
|
||||
}
|
||||
const { code, data } = await getGroupList(params);
|
||||
if (code === 200) {
|
||||
list.value = data.list;
|
||||
pageInfo.total = data.total;
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const onTableChange = (pagination, filters, sorter) => {
|
||||
if (sorter && sorter.field) {
|
||||
sortInfo.value.field = sorter.field;
|
||||
sortInfo.value.direction = sorter.order;
|
||||
} else {
|
||||
sortInfo.value.field = '';
|
||||
sortInfo.value.direction = '';
|
||||
}
|
||||
getData();
|
||||
};
|
||||
|
||||
const onPageChange = (current) => {
|
||||
pageInfo.page = current;
|
||||
getData();
|
||||
};
|
||||
const onPageSizeChange = (pageSize) => {
|
||||
pageInfo.pageSize = pageSize;
|
||||
pageInfo.page = 1;
|
||||
getData();
|
||||
};
|
||||
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@ -1,18 +1,62 @@
|
||||
@import '@/views/property-marketing/component.scss';
|
||||
|
||||
.account-manage-modal {
|
||||
border-radius: 8px;
|
||||
.arco-modal-header {
|
||||
border-bottom: none;
|
||||
height: 56px;
|
||||
padding: 22px 24px 16px 24px;
|
||||
.arco-modal-title {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
.arco-modal-body {
|
||||
padding: 16px 24px 20px;
|
||||
.arco-btn {
|
||||
.arco-btn-icon {
|
||||
line-height: 16px;
|
||||
}
|
||||
.arco-modal-footer {
|
||||
border-top: none;
|
||||
padding: 0;
|
||||
}
|
||||
.s1 {
|
||||
color: var(--Text-3, #737478);
|
||||
font-family: 'Alibaba PuHuiTi';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 22px; /* 157.143% */
|
||||
}
|
||||
.pagination-box {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
padding: 16px 24px;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
.arco-pagination {
|
||||
.arco-pagination-list {
|
||||
.arco-pagination-item {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--BG-300, #e6e6e8);
|
||||
&.arco-pagination-item-ellipsis {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.arco-pagination-item-active {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--Brand-Brand-6, #6d4cfe);
|
||||
}
|
||||
}
|
||||
}
|
||||
.arco-pagination-jumper-prepend {
|
||||
color: var(--Text-2, #3c4043);
|
||||
text-align: right;
|
||||
font-family: 'Alibaba PuHuiTi';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 22px; /* 157.143% */
|
||||
}
|
||||
.arco-select-view-single,
|
||||
.arco-pagination-jumper-input {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--BG-300, #e6e6e8);
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.danger-btn {
|
||||
border: none !important;
|
||||
background-color: #f64b31 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +1,7 @@
|
||||
@import "@/views/property-marketing/component.scss";
|
||||
.import-prompt-modal {
|
||||
border-radius: 8px;
|
||||
|
||||
.arco-modal-header {
|
||||
border-bottom: none;
|
||||
height: 56px;
|
||||
padding: 22px 24px 16px 24px;
|
||||
.arco-modal-title {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
.arco-modal-body {
|
||||
padding: 20px 24px 20px;
|
||||
.cancel-btn {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--BG-500, #b1b2b5);
|
||||
background: var(--BG-white, #fff);
|
||||
}
|
||||
.tip {
|
||||
color: var(--Text-1, #211f24);
|
||||
font-family: 'Alibaba PuHuiTi';
|
||||
@ -25,8 +11,4 @@
|
||||
line-height: 22px; /* 157.143% */
|
||||
}
|
||||
}
|
||||
.arco-modal-footer {
|
||||
border-top: none;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user