fix: 网址管理,功能优化。

This commit is contained in:
tianyongbao
2025-12-16 12:20:41 +08:00
parent d245ab8735
commit b17befa5f9

View File

@@ -166,8 +166,8 @@
<input v-model="toolForm.url" placeholder="例如https://www.baidu.com" />
</div>
</div>
<div class="form-row" v-if="toolForm.id || isCopyMode">
<div class="form-group" v-if="isCopyMode">
<div class="form-row">
<div class="form-group">
<label><span class="required">*</span>所属书签分类</label>
<select v-model="toolForm.superCategoryId" @change="onSuperCategoryChange">
<option v-for="superCat in superCategories" :key="superCat.id" :value="superCat.id">
@@ -183,12 +183,8 @@
</option>
</select>
</div>
<div class="form-group" v-if="!isCopyMode">
<label>显示地址</label>
<input v-model="toolForm.displayUrl" placeholder="例如www.baidu.com" />
</div>
</div>
<div class="form-row" v-if="isCopyMode">
<div class="form-row">
<div class="form-group">
<label>显示地址</label>
<input v-model="toolForm.displayUrl" placeholder="例如www.baidu.com" />
@@ -198,27 +194,7 @@
<input v-model="toolForm.desc" placeholder="例如:网址描述" />
</div>
</div>
<div class="form-row" v-else>
<div class="form-group">
<label>显示地址</label>
<input v-model="toolForm.displayUrl" placeholder="例如www.baidu.com" />
</div>
<div class="form-group">
<label>网址描述</label>
<input v-model="toolForm.desc" placeholder="例如:网址描述" />
</div>
</div>
<div class="form-row" v-if="toolForm.id">
<div class="form-group">
<label>网址描述</label>
<input v-model="toolForm.desc" placeholder="例如:网址描述" />
</div>
<div class="form-group">
<label>图标文字</label>
<input v-model="toolForm.icon" placeholder="例如:官" maxlength="4" />
</div>
</div>
<div class="form-row" v-else>
<div class="form-row">
<div class="form-group">
<label>图标文字</label>
<input v-model="toolForm.icon" placeholder="例如:官" maxlength="4" />
@@ -228,13 +204,6 @@
<input v-model.number="toolForm.sortOrder" type="number" placeholder="数字越小越靠前例如0" />
</div>
</div>
<div class="form-row" v-if="toolForm.id">
<div class="form-group">
<label>排序序号</label>
<input v-model.number="toolForm.sortOrder" type="number" placeholder="数字越小越靠前例如0" />
</div>
<div class="form-group"></div>
</div>
<div class="form-group">
<label>图标颜色</label>
<div class="color-picker">
@@ -387,12 +356,9 @@ export default {
// 可用的分组列表(编辑或复制时根据选择的大分类过滤)
availableCategories() {
if (this.isCopyMode && this.toolForm.superCategoryId) {
if (this.toolForm.superCategoryId) {
return this.categories.filter(c => c.superCategoryId === this.toolForm.superCategoryId)
}
if (this.toolForm.id) {
return this.currentCategories
}
return []
}
},
@@ -823,8 +789,13 @@ export default {
// 工具管理
showAddToolDialog(category) {
this.currentCategory = category
// 获取当前分组所属的大分类
const currentCategory = this.categories.find(c => c.id === category.id)
const superCategoryId = currentCategory ? currentCategory.superCategoryId : this.activeSuperCategoryId
this.toolForm = {
id: null,
superCategoryId: superCategoryId,
categoryId: category.id,
name: '',
desc: '',
@@ -840,8 +811,13 @@ export default {
editTool(category, tool) {
this.currentCategory = category
this.isCopyMode = false
// 获取当前分组所属的大分类
const currentCategory = this.categories.find(c => c.id === tool.categoryId)
const superCategoryId = currentCategory ? currentCategory.superCategoryId : this.activeSuperCategoryId
this.toolForm = {
id: tool.id,
superCategoryId: superCategoryId,
categoryId: tool.categoryId,
name: tool.name,
desc: tool.desc,