refactor(brand-materials):重构品牌物料页面

- 优化页面布局和样式,使用 flex布局
- 重新组织组件结构,提高可维护性- 改进搜索和分页功能,提升用户体验
- 统一按钮和输入框样式,增强一致性
- 移除冗余代码,提高代码可读性
This commit is contained in:
林志军
2025-07-01 13:55:54 +08:00
parent e6d0e19fb4
commit d0d459e0e0
7 changed files with 436 additions and 319 deletions

View File

@ -1,75 +1,88 @@
<template>
<view>
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
<a-space align="end">
<span class="part-div-header-title">业务洞察报告 </span>
</a-space>
<a-space align="center" class="search-form-div" size="medium">
<a-form-item field="name" class="search-form" label="服务/产品">
<a-input v-model="listQuery.name" placeholder="请搜索...">
<template #prefix>
<icon-search />
</template>
</a-input>
</a-form-item>
<a-form-item field="name" label="时间筛选">
<a-range-picker
showTime
:time-picker-props="{
defaultValue: ['00:00:00', '00:00:00'],
}"
style="width: 380px"
/>
</a-form-item>
<a-form-item field="name">
<a-space>
<a-button type="outline" class="search-btn" @click="handleSearch">
<div class="business-wrap">
<div class="filter-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid">
<div class="top flex h-64px px-24px py-10px justify-between items-center">
<p class="text-18px font-400 lh-26px color-#211F24 title">业务洞察报告</p>
</div>
<div class="container px-24px pt-12px pb-24px">
<div class="filter-row flex mb-20px">
<div class="filter-row-item flex items-center">
<span class="label">服务/产品</span>
<a-space size="medium">
<a-input v-model="query.name" class="w-240px" placeholder="请搜索..." size="medium" allow-clear>
<template #prefix>
<icon-search />
</template>
</a-input>
</a-space>
</div>
<div class="filter-row-item flex items-center">
<span class="label">时间筛选</span>
<a-space class="w-240px">
<a-range-picker size="medium" allow-clear format="YYYY-MM-DD HH:mm" class="w-100%" />
</a-space>
</div>
<div class="filter-row flex">
<a-button class="w-84px search-btn mr-12px" size="medium">
<template #icon>
<icon-search />
</template>
<template #default>搜索</template>
</a-button>
<a-button type="outline" class="reset-btn" @click="handleSearch">
<a-button class="w-84px reset-btn" size="medium">
<template #icon>
<icon-refresh />
</template>
<template #default>重置</template>
</a-button>
</a-space>
</a-form-item>
</a-space>
<a-table
:columns="columns"
:data="listResult.data"
:filter-icon-align-left="alignLeft"
@change="handleChange"
:scroll="true"
:pagination="false"
>
</div>
</div>
</div>
</div>
<div
class="table-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid px-24px py-24px flex-1 flex flex-col"
>
<a-table :columns="columns" :data="tableData" @change="handleChange" :pagination="false">
</a-table>
<a-pagination
style="float: right"
:total="listResult.total"
:size="listQuery.size"
show-total
show-jumper
show-page-size
/>
</a-space>
</view>
<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>
</div>
</div>
</template>
<script setup lang="ts">
const listQuery = reactive({
name: '',
size: 0,
import { reactive, ref } from 'vue';
const pageInfo = reactive({
page: 1,
pageSize: 20,
total: 0,
});
const query = reactive({
name: ref(''),
});
const listResult = reactive({
data: [],
total: 0,
});
const onPageSizeChange = () => {};
const tableData = ref([]);
const handleChange = () => {};
const onPageChange = () => {};
const columns = [
{
title: '服务/产品',
@ -83,9 +96,6 @@ const columns = [
dataIndex: 'create_time',
width: 120,
minWidth: 120,
sortable: {
sortDirections: ['ascend', 'descend'],
},
},
{
titleSlotName: 'hotTitle',
@ -107,9 +117,6 @@ const columns = [
dataIndex: 'volumeRate',
width: 180,
minWidth: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
},
slotName: 'lasterUpdateTime',
},
{
@ -118,43 +125,88 @@ const columns = [
width: 120,
minWidth: 120,
},
{
title: '操作',
dataIndex: 'operator',
width: 120,
minWidth: 120,
},
];
</script>
<style scoped lang="less">
.part-div-header-title {
justify-content: center;
<style scoped lang="scss">
.business-wrap {
height: 100%;
display: flex;
flex-direction: column;
color: var(--Text-1, #211f24);
font-size: 18px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 26px;
word-wrap: break-word;
}
.search-form-div {
margin-top: 10px;
}
:deep(.search-btn) {
border-radius: 4px;
border: 1px solid var(--Brand-Brand-6, #6d4cfe);
color: #6d4cfe;
}
:deep(.arco-picker),
:deep(.arco-input-wrapper) {
border-radius: 4px;
border-color: #d7d7d9;
background-color: #fff;
height: 32px;
:deep(.edit-btn) {
border: 1px solid var(--Brand-Brand-6, #6d4cfe);
color: #6d4cfe;
}
&: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);
:deep(.reset-btn) {
border-radius: 4px;
border: 1px solid var(--BG-500, #b1b2b5);
background: var(--BG-white, #fff);
}
:deep(.arco-input-wrapper),
:deep(.arco-select-view-single),
:deep(.arco-textarea-wrapper),
:deep(.arco-picker),
:deep(.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);
}
}
.table-wrap {
width: 100%;
.pagination-box {
display: flex;
width: 100%;
padding: 16px 24px;
justify-content: flex-end;
align-items: center;
}
margin-top: 20px;
}
.container {
.filter-row {
.filter-row-item {
&:not(:last-child) {
margin-right: 24px;
}
.label {
margin-right: 8px;
color: #211f24;
font-family: 'Alibaba PuHuiTi';
font-size: 14px;
font-style: normal;
font-weight: 400;
flex-shrink: 0;
line-height: 22px; /* 157.143% */
}
}
}
}
}
.reset-btn {
min-width: 72px;
color: black;
}
</style>

View File

@ -1,74 +1,84 @@
<template>
<view>
<a-space direction="vertical" style="background-color: #fff; width: 100%; padding: 24px; margin: 24px 0">
<a-space align="end">
<span class="part-div-header-title">竞品对比报告 </span>
</a-space>
<a-space align="center" class="search-form-div" size="medium">
<a-form-item field="name" class="" label="服务/产品">
<a-input v-model="listQuery.name" placeholder="请搜索...">
<template #prefix>
<icon-search />
</template>
</a-input>
</a-form-item>
<a-form-item field="name" label="时间筛选">
<a-range-picker
showTime
:time-picker-props="{
defaultValue: ['00:00:00', '00:00:00'],
}"
style="width: 380px"
/>
</a-form-item>
<a-form-item field="name">
<a-space>
<a-button type="outline" class="search-btn" @click="handleSearch">
<div class="competitive-wrap">
<div class="filter-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid">
<div class="top flex h-64px px-24px py-10px justify-between items-center">
<p class="text-18px font-400 lh-26px color-#211F24 title">竞品对比报告</p>
</div>
<div class="container px-24px pt-12px pb-24px">
<div class="filter-row flex mb-20px">
<div class="filter-row-item flex items-center">
<span class="label">服务/产品</span>
<a-space size="medium">
<a-input v-model="query.name" class="w-240px" placeholder="请搜索..." size="medium" allow-clear>
<template #prefix>
<icon-search />
</template>
</a-input>
</a-space>
</div>
<div class="filter-row-item flex items-center">
<span class="label">时间筛选</span>
<a-space class="w-240px">
<a-range-picker size="medium" allow-clear format="YYYY-MM-DD HH:mm" class="w-100%" />
</a-space>
</div>
<div class="filter-row flex">
<a-button class="w-84px search-btn mr-12px" size="medium">
<template #icon>
<icon-search />
</template>
<template #default>搜索</template>
</a-button>
<a-button type="outline" class="reset-btn" @click="handleSearch">
<a-button class="w-84px reset-btn" size="medium">
<template #icon>
<icon-refresh />
</template>
<template #default>重置</template>
</a-button>
</a-space>
</a-form-item>
</a-space>
<a-table
:columns="columns"
:data="listResult.data"
:filter-icon-align-left="alignLeft"
@change="handleChange"
:scroll="true"
:pagination="false"
>
</div>
</div>
</div>
</div>
<div
class="table-wrap bg-#fff rounded-8px border-1px border-#D7D7D9 border-solid px-24px py-24px flex-1 flex flex-col"
>
<a-table :columns="columns" :data="tableData" @change="handleChange" :pagination="false">
</a-table>
<a-pagination
style="float: right"
:total="listResult.total"
:size="listQuery.size"
show-total
show-jumper
show-page-size
/>
</a-space>
</view>
<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>
</div>
</div>
</template>
<script setup lang="ts">
const listQuery = reactive({
name: '',
size: 0,
});
import { reactive, ref } from 'vue';
const listResult = reactive({
data: [],
const pageInfo = reactive({
page: 1,
pageSize: 20,
total: 0,
});
const query = reactive({
name: ref(''),
});
const handleChange = () => {};
const onPageChange = () => {};
const onPageSizeChange = () => {};
const tableData = ref([]);
const columns = [
{
@ -83,25 +93,22 @@ const columns = [
dataIndex: 'create_time',
width: 120,
minWidth: 120,
},
{
titleSlotName: 'hotTitle',
titleSlotName: 'customer',
width: 180,
minWidth: 180,
title: '竞争对手',
dataIndex: 'customer',
slotName: 'hot',
},
{
titleSlotName: 'lasterUpdateTime',
title: '最后更新日期',
dataIndex: 'volumeRate',
width: 180,
minWidth: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
},
slotName: 'lasterUpdateTime',
},
{
@ -112,47 +119,86 @@ const columns = [
},
{
title: '操作',
dataIndex: 'handle',
dataIndex: 'operator',
width: 120,
minWidth: 120,
},
];
</script>
<style scoped lang="less">
.part-div-header-title {
justify-content: center;
<style scoped lang="scss">
.competitive-wrap {
height: 100%;
display: flex;
flex-direction: column;
color: var(--Text-1, #211f24);
font-size: 18px;
font-family: Alibaba PuHuiTi;
font-weight: 400;
line-height: 26px;
word-wrap: break-word;
}
.search-form-div {
margin-top: 10px;
}
:deep(.search-btn) {
border-radius: 4px;
border: 1px solid var(--Brand-Brand-6, #6d4cfe);
color: #6d4cfe;
}
:deep(.arco-picker),
:deep(.arco-input-wrapper) {
border-radius: 4px;
border-color: #d7d7d9;
background-color: #fff;
height: 32px;
:deep(.edit-btn) {
border: 1px solid var(--Brand-Brand-6, #6d4cfe);
color: #6d4cfe;
}
&: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);
:deep(.reset-btn) {
border-radius: 4px;
border: 1px solid var(--BG-500, #b1b2b5);
background: var(--BG-white, #fff);
}
:deep(.arco-input-wrapper),
:deep(.arco-select-view-single),
:deep(.arco-textarea-wrapper),
:deep(.arco-picker),
:deep(.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);
}
}
.table-wrap {
width: 100%;
.pagination-box {
display: flex;
width: 100%;
padding: 16px 24px;
justify-content: flex-end;
align-items: center;
}
margin-top: 20px;
}
.container {
.filter-row {
.filter-row-item {
&:not(:last-child) {
margin-right: 24px;
}
.label {
margin-right: 8px;
color: #211f24;
font-family: 'Alibaba PuHuiTi';
font-size: 14px;
font-style: normal;
font-weight: 400;
flex-shrink: 0;
line-height: 22px; /* 157.143% */
}
}
}
}
}
.reset-btn {
min-width: 72px;
color: black;
}
</style>