标签组管理
This commit is contained in:
parent
b0a86767ce
commit
05d17a539e
|
|
@ -57,7 +57,7 @@ export function addLabelAPI(data) {
|
|||
}
|
||||
|
||||
/* 数据管理->标签管理->修改标签 */
|
||||
export function editDataAPI(data) {
|
||||
export function editLabelAPI(data) {
|
||||
return request({
|
||||
url: '/smartPlatform/data/label/editLabelData',
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
|
||||
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
|
||||
<div>
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px" label-position="top">
|
||||
<el-form-item label="标签组名称" prop="labelGroupName">
|
||||
<el-input class="form-item" v-model="form.labelGroupName" clearable show-word-limit
|
||||
placeholder="请输入标签组名称" maxlength="32" :disabled="isDisabled"></el-input>
|
||||
|
|
@ -42,6 +42,8 @@ export default {
|
|||
isDisabled: true,
|
||||
form: {
|
||||
labelGroupId: null,
|
||||
labelId: null,
|
||||
labelGroupName: '',
|
||||
labelName: '',
|
||||
labelDesc: '',
|
||||
},
|
||||
|
|
@ -57,6 +59,9 @@ export default {
|
|||
handler(newVal) {
|
||||
if (newVal === CONSTANT_PARAMS.type) {
|
||||
this.initFormData();
|
||||
}else{
|
||||
this.form.labelGroupName = this.rowData.labelGroupName
|
||||
this.form.labelGroupId = this.rowData.labelGroupId
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
|
|
@ -75,6 +80,7 @@ export default {
|
|||
this.form = {
|
||||
labelGroupId: this.rowData.labelGroupId,
|
||||
labelGroupName: this.rowData.labelGroupName || '',
|
||||
labelId: this.rowData.labelId || '',
|
||||
labelName: this.rowData.labelName || '',
|
||||
labelDesc: this.rowData.labelDesc || '',
|
||||
};
|
||||
|
|
@ -94,7 +100,8 @@ export default {
|
|||
reset() {
|
||||
this.form = {
|
||||
labelGroupId: null,
|
||||
groupId: null,
|
||||
labelId: null,
|
||||
labelGroupName: '',
|
||||
labelName: '',
|
||||
labelDesc: '',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
|
||||
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
|
||||
<div>
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px">
|
||||
<el-form :model="form" :rules="rules" ref="ruleForm" label-width="110px" label-position="top">
|
||||
<el-form-item label="标签组名称" prop="labelGroupName">
|
||||
<el-input class="form-item" v-model="form.labelGroupName" clearable show-word-limit
|
||||
placeholder="请输入标签组名称" maxlength="32"></el-input>
|
||||
|
|
|
|||
|
|
@ -8,21 +8,24 @@
|
|||
<i slot="suffix" class="el-input__icon el-icon-search" style="cursor: pointer;" @click="handleSearch"></i>
|
||||
</el-input>
|
||||
<div class="category-list">
|
||||
<div v-for="item in categoryList" :key="item.labelGroupId" class="category-item"
|
||||
:class="{ active: activeCategory === item.labelGroupId }"
|
||||
@click="handleCategoryClick(item.labelGroupId)">
|
||||
<i class="el-icon-folder" style="margin-right: 8px; color: #666;"></i>
|
||||
<span class="category-name">{{ item.labelGroupName }}</span>
|
||||
<el-dropdown trigger="click" @command="handleCategoryCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-more"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{ type: 'edit', raw: item }">编辑</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', raw: item }">删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<template v-if="categoryList.length > 0">
|
||||
<div v-for="item in categoryList" :key="item.labelGroupId" class="category-item"
|
||||
:class="{ active: activeCategory === item.labelGroupId }"
|
||||
@click="handleCategoryClick(item)">
|
||||
<i class="el-icon-folder" style="margin-right: 8px; color: #666;"></i>
|
||||
<span class="category-name">{{ item.labelGroupName }}</span>
|
||||
<el-dropdown trigger="click" @command="handleCategoryCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-more"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{ type: 'edit', raw: item }">编辑</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', raw: item }">删除</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
<el-empty v-else description="无数据" :image-size="80"></el-empty>
|
||||
</div>
|
||||
<!-- 添加标签组弹窗 -->
|
||||
<LabelGroupForm ref="labelGroupForm" v-if="isflag" :isAdd="isAdd" :rowData="row" @handleQuery="handleQuery" :title="title"
|
||||
|
|
@ -47,6 +50,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
activeCategory: null,
|
||||
activeCategoryName: '',
|
||||
categoryList: [],
|
||||
title: "",
|
||||
isflag: false,
|
||||
|
|
@ -81,7 +85,8 @@ export default {
|
|||
if (res.data.length > 0 && !this.activeCategory) {
|
||||
const labelGroupId = res.data[0].labelGroupId;
|
||||
this.activeCategory = labelGroupId
|
||||
this.$emit('change', labelGroupId)
|
||||
this.activeCategoryName = res.data[0].labelGroupName
|
||||
this.$emit('change', labelGroupId, this.activeCategoryName)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -92,9 +97,9 @@ export default {
|
|||
this.row = {};
|
||||
this.isflag = true;
|
||||
},
|
||||
handleCategoryClick(id) {
|
||||
this.activeCategory = id
|
||||
this.$emit('change', id)
|
||||
handleCategoryClick(item) {
|
||||
this.activeCategory = item.labelGroupId
|
||||
this.$emit('change', item.labelGroupId, item.labelGroupName)
|
||||
this.handleQuery();
|
||||
},
|
||||
handleCategoryCommand(command) {
|
||||
|
|
@ -125,6 +130,7 @@ export default {
|
|||
if (res.code === 200) {
|
||||
this.$message.success('删除成功');
|
||||
this.activeCategory = null;
|
||||
this.$emit('change', null, null)
|
||||
this.handleQuery();
|
||||
} else {
|
||||
this.$message.error(res.msg || '删除失败');
|
||||
|
|
|
|||
|
|
@ -7,21 +7,22 @@
|
|||
<h3>数据列表</h3>
|
||||
</template>
|
||||
<template slot="tableActions">
|
||||
<el-button @click="handleAdd" :disabled="disabled" v-hasPermi="['data:label:add']"
|
||||
class="add-btn"><i class="el-icon-plus"></i> 新增</el-button>
|
||||
<el-button @click="handleAdd" :disabled="disabled" v-hasPermi="['data:label:add']" class="add-btn"><i
|
||||
class="el-icon-plus"></i> 新增</el-button>
|
||||
</template>
|
||||
<template slot="handle" slot-scope="{ data }">
|
||||
<el-button type="text" v-hasPermi="['data:label:edit']" class="action-btn"
|
||||
style="color: #EAA819;" @click="handleUpdate(data)">
|
||||
<el-button type="text" v-hasPermi="['data:label:edit']" class="action-btn" style="color: #EAA819;"
|
||||
@click="handleUpdate(data)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button type="text" v-hasPermi="['data:label:del']" class="action-btn"
|
||||
style="color: #DB3E29;" @click="handleDelete(data)">
|
||||
<el-button type="text" v-hasPermi="['data:label:del']" class="action-btn" style="color: #DB3E29;"
|
||||
@click="handleDelete(data)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</TableModel>
|
||||
<LabelForm ref="labelForm" v-if="dialogVisible" :isAdd="isAdd" :rowData="rowData" @handleQuery="handleQuery" :title="title" :disabled="disabled" @closeDialog="closeDialog" />
|
||||
<LabelForm ref="labelForm" v-if="isflag" :isAdd="isAdd" :rowData="rowData" @handleQuery="handleQuery"
|
||||
:title="title" :disabled="disabled" @closeDialog="closeDialog" :width="600" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -42,17 +43,21 @@ export default {
|
|||
type: [String, Number],
|
||||
default: null
|
||||
},
|
||||
activeCategoryName: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formLabel,
|
||||
columnsList,
|
||||
labelListAPI,
|
||||
dialogVisible: false,
|
||||
isflag: false,
|
||||
fileData: {},
|
||||
rowData: {},
|
||||
title: '',
|
||||
isAdd: '',
|
||||
isAdd: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -84,24 +89,34 @@ export default {
|
|||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.rowData = {}
|
||||
this.rowData = {
|
||||
labelGroupName: this.activeCategoryName,
|
||||
labelGroupId: this.value
|
||||
}
|
||||
this.title = '新增标签'
|
||||
this.isAdd = 'add'
|
||||
this.dialogVisible = true
|
||||
this.isflag = true
|
||||
},
|
||||
|
||||
/** 修改操作 */
|
||||
handleUpdate(row) {
|
||||
this.rowData = row
|
||||
this.rowData = {
|
||||
labelGroupName: this.activeCategoryName,
|
||||
...row
|
||||
}
|
||||
this.title = '编辑标签'
|
||||
this.isAdd = 'edit'
|
||||
this.dialogVisible = true
|
||||
this.isflag = true
|
||||
},
|
||||
/* 搜索操作 */
|
||||
handleQuery() {
|
||||
this.$refs.labelTableRef.getTableList()
|
||||
},
|
||||
|
||||
closeDialog() {
|
||||
this.isflag = false;
|
||||
},
|
||||
|
||||
/** 删除操作 */
|
||||
handleDelete(raw) {
|
||||
this.$confirm(`确定要删除标签名称"${raw.labelName}"吗?删除后将无法恢复!`, '操作提示', {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<LeftLabelGroup :value="activeCategory" @change="handleCategoryChange" />
|
||||
</el-col>
|
||||
<el-col :span="20" class="right-col">
|
||||
<RightTable :value="activeCategory" />
|
||||
<RightTable :value="activeCategory" :activeCategoryName="activeCategoryName" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
|
@ -26,11 +26,13 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
activeCategory: null,
|
||||
activeCategoryName: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCategoryChange(categoryId) {
|
||||
handleCategoryChange(categoryId, categoryName) {
|
||||
this.activeCategory = categoryId
|
||||
this.activeCategoryName = categoryName
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue