diff --git a/src/api/data/label.js b/src/api/data/label.js index 5c06298..066a97d 100644 --- a/src/api/data/label.js +++ b/src/api/data/label.js @@ -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', diff --git a/src/views/data/label/components/LabelForm.vue b/src/views/data/label/components/LabelForm.vue index 3654ab9..96e8fa1 100644 --- a/src/views/data/label/components/LabelForm.vue +++ b/src/views/data/label/components/LabelForm.vue @@ -3,7 +3,7 @@
- + @@ -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: '', }; diff --git a/src/views/data/label/components/LabelGroupForm.vue b/src/views/data/label/components/LabelGroupForm.vue index 9f9dd0f..e9d35cf 100644 --- a/src/views/data/label/components/LabelGroupForm.vue +++ b/src/views/data/label/components/LabelGroupForm.vue @@ -3,7 +3,7 @@
- + diff --git a/src/views/data/label/components/LeftLabelGroup.vue b/src/views/data/label/components/LeftLabelGroup.vue index 8f2d5e1..13baa52 100644 --- a/src/views/data/label/components/LeftLabelGroup.vue +++ b/src/views/data/label/components/LeftLabelGroup.vue @@ -8,21 +8,24 @@
-
- - {{ item.labelGroupName }} - - - - - - 编辑 - 删除 - - -
+ +
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 || '删除失败'); diff --git a/src/views/data/label/components/RightTable.vue b/src/views/data/label/components/RightTable.vue index b25db34..536458c 100644 --- a/src/views/data/label/components/RightTable.vue +++ b/src/views/data/label/components/RightTable.vue @@ -7,21 +7,22 @@

数据列表

- +
@@ -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}"吗?删除后将无法恢复!`, '操作提示', { diff --git a/src/views/data/label/index.vue b/src/views/data/label/index.vue index 77c10d4..6874977 100644 --- a/src/views/data/label/index.vue +++ b/src/views/data/label/index.vue @@ -6,7 +6,7 @@ - +
@@ -26,11 +26,13 @@ export default { data() { return { activeCategory: null, + activeCategoryName: '', } }, methods: { - handleCategoryChange(categoryId) { + handleCategoryChange(categoryId, categoryName) { this.activeCategory = categoryId + this.activeCategoryName = categoryName }, } }