|
|
@@ -19,7 +19,7 @@
|
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="openDialog(null)">新增关键词</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
- <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
|
|
+ <el-button type="warning" icon="el-icon-download" size="mini" :loading="exportLoading" @click="handleExport">导出</el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="loadList" />
|
|
|
</el-row>
|
|
|
@@ -30,9 +30,9 @@
|
|
|
<el-table-column label="关键词内容" prop="keyword" min-width="200" />
|
|
|
<el-table-column label="类型" prop="keywordType" min-width="100" align="center">
|
|
|
<template slot-scope="s">
|
|
|
- <el-tag v-if="s.row.keywordType === 1" type="danger" size="mini">违禁词</el-tag>
|
|
|
- <el-tag v-else-if="s.row.keywordType === 2" type="warning" size="mini">敏感词</el-tag>
|
|
|
- <el-tag v-else size="mini">{{ s.row.keywordType || '-' }}</el-tag>
|
|
|
+ <el-tag v-if="s.row.keywordType == 1" type="danger" size="mini">{{ getTypeLabel(s.row.keywordType) }}</el-tag>
|
|
|
+ <el-tag v-else-if="s.row.keywordType == 2" type="warning" size="mini">{{ getTypeLabel(s.row.keywordType) }}</el-tag>
|
|
|
+ <el-tag v-else size="mini">{{ getTypeLabel(s.row.keywordType) || '-' }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="创建时间" prop="createTime" min-width="150" align="center" />
|
|
|
@@ -54,8 +54,8 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类型" prop="keywordType">
|
|
|
<el-select v-model="form.keywordType" placeholder="请选择类型" style="width:100%">
|
|
|
- <el-option label="违禁词" :value="1" />
|
|
|
- <el-option label="敏感词" :value="2" />
|
|
|
+ <el-option v-for="item in typeOptions" :key="item.dictValue"
|
|
|
+ :label="item.dictLabel" :value="item.dictValue" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
@@ -72,6 +72,7 @@
|
|
|
|
|
|
<script>
|
|
|
import request from '@/utils/request'
|
|
|
+import { exportKeyword } from '@/api/system/keyword'
|
|
|
|
|
|
export default {
|
|
|
name: 'AdminKeywordManage',
|
|
|
@@ -79,6 +80,8 @@ export default {
|
|
|
return {
|
|
|
showSearch: true,
|
|
|
loading: false,
|
|
|
+ exportLoading: false,
|
|
|
+ typeOptions: [],
|
|
|
dataList: [],
|
|
|
total: 0,
|
|
|
queryParams: { pageNum: 1, pageSize: 10, keyword: null },
|
|
|
@@ -93,6 +96,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ this.getDicts('keyword_type').then(response => {
|
|
|
+ this.typeOptions = response.data
|
|
|
+ })
|
|
|
this.loadList()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -144,14 +150,15 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
handleExport() {
|
|
|
- request({ url: '/system/keyword/export', method: 'get', params: this.queryParams, responseType: 'blob' }).then(r => {
|
|
|
- const blob = new Blob([r])
|
|
|
- const link = document.createElement('a')
|
|
|
- link.href = URL.createObjectURL(blob)
|
|
|
- link.download = '关键词数据.xlsx'
|
|
|
- link.click()
|
|
|
- URL.revokeObjectURL(link.href)
|
|
|
- })
|
|
|
+ this.exportLoading = true
|
|
|
+ exportKeyword(this.queryParams).then(response => {
|
|
|
+ this.download(response.msg)
|
|
|
+ this.exportLoading = false
|
|
|
+ }).catch(() => { this.exportLoading = false })
|
|
|
+ },
|
|
|
+ getTypeLabel(value) {
|
|
|
+ const item = this.typeOptions.find(o => o.dictValue == value)
|
|
|
+ return item ? item.dictLabel : null
|
|
|
},
|
|
|
reset() {
|
|
|
this.form = { keywordId: null, keyword: '', keywordType: 1, remark: '' }
|