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