feat(merchant): 添加JSON编辑器折叠功能
- 新增可折叠的JSON批量编辑区域 - 实现点击标题展开/收起编辑器 - 添加折叠状态图标切换显示 - 设置默认折叠状态以节省空间 - 增加上下箭头图标指示折叠状态 - 优化样式布局和悬停效果
This commit is contained in:
@@ -1,25 +1,44 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="rate-table-container">
|
<div class="rate-table-container">
|
||||||
<div class="serialization-section">
|
<div class="serialization-section">
|
||||||
<a-space direction="vertical" style="width: 100%; margin-bottom: 16px">
|
<div
|
||||||
|
class="section-header"
|
||||||
|
@click="isJsonEditorCollapsed = !isJsonEditorCollapsed"
|
||||||
|
>
|
||||||
<a-typography-text type="secondary">
|
<a-typography-text type="secondary">
|
||||||
批量编辑 (JSON格式) - 与表格实时同步
|
批量编辑 (JSON格式) - 与表格实时同步
|
||||||
</a-typography-text>
|
</a-typography-text>
|
||||||
<a-textarea
|
<a-button size="mini" type="text">
|
||||||
v-model="serializationData"
|
<template #icon>
|
||||||
placeholder="在此编辑JSON数据,表格会实时同步更新"
|
<icon-down v-if="isJsonEditorCollapsed" />
|
||||||
auto-size
|
<icon-up v-else />
|
||||||
allow-clear
|
</template>
|
||||||
/>
|
</a-button>
|
||||||
<a-space>
|
</div>
|
||||||
<a-button size="small" status="warning" @click="resetToDefault">
|
|
||||||
<template #icon>
|
<a-collapse-transition>
|
||||||
<icon-refresh />
|
<div v-show="!isJsonEditorCollapsed">
|
||||||
</template>
|
<a-space
|
||||||
还原默认
|
direction="vertical"
|
||||||
</a-button>
|
style="width: 100%; margin-bottom: 16px"
|
||||||
</a-space>
|
>
|
||||||
</a-space>
|
<a-textarea
|
||||||
|
v-model="serializationData"
|
||||||
|
placeholder="在此编辑JSON数据,表格会实时同步更新"
|
||||||
|
auto-size
|
||||||
|
allow-clear
|
||||||
|
/>
|
||||||
|
<a-space>
|
||||||
|
<a-button size="small" status="warning" @click="resetToDefault">
|
||||||
|
<template #icon>
|
||||||
|
<icon-refresh />
|
||||||
|
</template>
|
||||||
|
还原默认
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-space>
|
||||||
|
</div>
|
||||||
|
</a-collapse-transition>
|
||||||
</div>
|
</div>
|
||||||
<a-table
|
<a-table
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
@@ -124,6 +143,7 @@ const generateTableData = () => {
|
|||||||
};
|
};
|
||||||
const tableData = defineModel<merchantDeployRate[]>();
|
const tableData = defineModel<merchantDeployRate[]>();
|
||||||
const serializationData = ref('');
|
const serializationData = ref('');
|
||||||
|
const isJsonEditorCollapsed = ref(true); // 默认折叠
|
||||||
|
|
||||||
const { copy } = useClipboard();
|
const { copy } = useClipboard();
|
||||||
|
|
||||||
@@ -281,6 +301,27 @@ const resetToDefault = () => {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
border: 1px solid #e5e6eb;
|
border: 1px solid #e5e6eb;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 4px 0;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgb(0 0 0 / 2%);
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 0 -4px;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 折叠动画容器
|
||||||
|
.arco-collapse-transition {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user