Compare commits
1 Commits
97f2e6a17c
...
5.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ef2b697a3 |
@@ -52,3 +52,16 @@ export function doEdit(id, data) {
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建话题分类
|
||||
* @param {title: string} data
|
||||
* @returns
|
||||
*/
|
||||
export function doAdd(data) {
|
||||
return request({
|
||||
url: '/management/api/rating/topic_category',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { doEdit } from '@/api/rating/topicCategory'
|
||||
import { doEdit, doAdd } from '@/api/rating/topicCategory'
|
||||
|
||||
export default {
|
||||
name: 'TopicCategoryEdit',
|
||||
@@ -38,12 +38,11 @@
|
||||
methods: {
|
||||
showEdit(row) {
|
||||
if (!row) {
|
||||
// 当前接口似乎只提供了编辑,如果需要新增可在此扩展
|
||||
this.title = '添加话题分类'
|
||||
this.title = '创建分类'
|
||||
this.id = ''
|
||||
this.form = this.$options.data().form
|
||||
} else {
|
||||
this.title = '编辑话题分类'
|
||||
this.title = '编辑分类'
|
||||
this.id = row.id
|
||||
this.form = {
|
||||
title: row.title || '',
|
||||
@@ -67,6 +66,9 @@
|
||||
if (this.id) {
|
||||
const { msg } = await doEdit(this.id, this.form)
|
||||
this.$baseMessage(msg || '编辑成功', 'success')
|
||||
} else {
|
||||
const { msg } = await doAdd({ title: this.form.title })
|
||||
this.$baseMessage(msg || '创建成功', 'success')
|
||||
}
|
||||
this.$emit('fetch-data')
|
||||
this.close()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<div class="topic-category-container">
|
||||
<vab-query-form>
|
||||
<vab-query-form-right-panel :span="24">
|
||||
<vab-query-form-left-panel :span="12">
|
||||
<el-button icon="el-icon-plus" type="primary" @click="handleAdd">创建类别</el-button>
|
||||
</vab-query-form-left-panel>
|
||||
<vab-query-form-right-panel :span="12">
|
||||
<el-form :inline="true" :model="queryForm" @submit.native.prevent>
|
||||
<el-form-item>
|
||||
<el-input v-model.trim="queryForm.keyword" clearable placeholder="请输入分类名称" />
|
||||
@@ -75,6 +78,9 @@
|
||||
},
|
||||
methods: {
|
||||
formatTime,
|
||||
handleAdd() {
|
||||
this.$refs['edit'].showEdit()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.queryForm.pageSize = val
|
||||
this.fetchData()
|
||||
|
||||
Reference in New Issue
Block a user