|
@@ -12,17 +12,23 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="类型" prop="type">
|
|
<el-form-item label="类型" prop="type">
|
|
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
|
|
<el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in typeOptions"
|
|
|
|
+ :key="dict.dictValue"
|
|
|
|
+ :label="dict.dictLabel"
|
|
|
|
+ :value="dict.dictValue"
|
|
|
|
+ />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="所属公司" prop="companyId">
|
|
<el-form-item label="所属公司" prop="companyId">
|
|
- <el-input
|
|
|
|
- v-model="queryParams.companyId"
|
|
|
|
- placeholder="请输入所属公司"
|
|
|
|
- clearable
|
|
|
|
- size="small"
|
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-select filterable v-model="queryParams.companyId" placeholder="请选择所属公司" clearable size="small">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in companys"
|
|
|
|
+ :key="item.companyId"
|
|
|
|
+ :label="item.companyName"
|
|
|
|
+ :value="item.companyId"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
@@ -80,8 +86,8 @@
|
|
<el-table border v-loading="loading" :data="keywordList" @selection-change="handleSelectionChange">
|
|
<el-table border v-loading="loading" :data="keywordList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="关键字" align="center" prop="keyword" />
|
|
<el-table-column label="关键字" align="center" prop="keyword" />
|
|
- <el-table-column label="类型" align="center" prop="type" />
|
|
|
|
- <el-table-column label="所属公司" align="center" prop="companyId" />
|
|
|
|
|
|
+ <el-table-column label="类型" align="center" prop="typeName" />
|
|
|
|
+ <el-table-column label="所属公司" align="center" prop="companyName" />
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
<el-button
|
|
@@ -110,19 +116,31 @@
|
|
@pagination="getList"
|
|
@pagination="getList"
|
|
/>
|
|
/>
|
|
|
|
|
|
- <!-- 添加或修改系统关键字对话框 -->
|
|
|
|
|
|
+ <!-- 添加或修改关键字对话框 -->
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
<el-form-item label="关键字" prop="keyword">
|
|
<el-form-item label="关键字" prop="keyword">
|
|
<el-input v-model="form.keyword" placeholder="请输入关键字" />
|
|
<el-input v-model="form.keyword" placeholder="请输入关键字" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="类型:1-看课弹幕;" prop="type">
|
|
|
|
- <el-select v-model="form.type" placeholder="请选择类型:1-看课弹幕;">
|
|
|
|
- <el-option label="请选择字典生成" value="" />
|
|
|
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
|
+ <el-select v-model="form.type" placeholder="请选择类型">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="dict in typeOptions"
|
|
|
|
+ :key="dict.dictValue"
|
|
|
|
+ :label="dict.dictLabel"
|
|
|
|
+ :value="dict.dictValue"
|
|
|
|
+ />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="所属公司" prop="companyId">
|
|
<el-form-item label="所属公司" prop="companyId">
|
|
- <el-input v-model="form.companyId" placeholder="请输入所属公司" />
|
|
|
|
|
|
+ <el-select filterable v-model="form.companyId" placeholder="请选择所属公司">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in companys"
|
|
|
|
+ :key="item.companyId"
|
|
|
|
+ :label="item.companyName"
|
|
|
|
+ :value="item.companyId"
|
|
|
|
+ />
|
|
|
|
+ </el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -135,6 +153,8 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { listKeyword, getKeyword, delKeyword, addKeyword, updateKeyword, exportKeyword } from "@/api/system/keyword";
|
|
import { listKeyword, getKeyword, delKeyword, addKeyword, updateKeyword, exportKeyword } from "@/api/system/keyword";
|
|
|
|
+import { allList } from "@/api/system/dict/data";
|
|
|
|
+import { getCompanyList } from "@/api/company/companyUser";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "Keyword",
|
|
name: "Keyword",
|
|
@@ -154,12 +174,16 @@ export default {
|
|
showSearch: true,
|
|
showSearch: true,
|
|
// 总条数
|
|
// 总条数
|
|
total: 0,
|
|
total: 0,
|
|
- // 系统关键字表格数据
|
|
|
|
|
|
+ // 关键字表格数据
|
|
keywordList: [],
|
|
keywordList: [],
|
|
// 弹出层标题
|
|
// 弹出层标题
|
|
title: "",
|
|
title: "",
|
|
// 是否显示弹出层
|
|
// 是否显示弹出层
|
|
open: false,
|
|
open: false,
|
|
|
|
+ // 类型选项
|
|
|
|
+ typeOptions: [],
|
|
|
|
+ // 公司列表
|
|
|
|
+ companys: [],
|
|
// 查询参数
|
|
// 查询参数
|
|
queryParams: {
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
@@ -177,9 +201,11 @@ export default {
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getList();
|
|
this.getList();
|
|
|
|
+ this.getTypeOptions();
|
|
|
|
+ this.getCompanyOptions();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- /** 查询系统关键字列表 */
|
|
|
|
|
|
+ /** 查询关键字列表 */
|
|
getList() {
|
|
getList() {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
listKeyword(this.queryParams).then(response => {
|
|
listKeyword(this.queryParams).then(response => {
|
|
@@ -225,7 +251,7 @@ export default {
|
|
handleAdd() {
|
|
handleAdd() {
|
|
this.reset();
|
|
this.reset();
|
|
this.open = true;
|
|
this.open = true;
|
|
- this.title = "添加系统关键字";
|
|
|
|
|
|
+ this.title = "添加关键字";
|
|
},
|
|
},
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
@@ -233,22 +259,29 @@ export default {
|
|
const keywordId = row.keywordId || this.ids
|
|
const keywordId = row.keywordId || this.ids
|
|
getKeyword(keywordId).then(response => {
|
|
getKeyword(keywordId).then(response => {
|
|
this.form = response.data;
|
|
this.form = response.data;
|
|
|
|
+ // 强制把type转成字符串
|
|
|
|
+ this.form.type = String(response.data.type);
|
|
this.open = true;
|
|
this.open = true;
|
|
- this.title = "修改系统关键字";
|
|
|
|
|
|
+ this.title = "修改关键字";
|
|
});
|
|
});
|
|
},
|
|
},
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ // 提交前移除临时属性
|
|
|
|
+ const submitData = { ...this.form };
|
|
|
|
+ delete submitData.typeName;
|
|
|
|
+ delete submitData.companyName;
|
|
|
|
+
|
|
if (this.form.keywordId != null) {
|
|
if (this.form.keywordId != null) {
|
|
- updateKeyword(this.form).then(response => {
|
|
|
|
|
|
+ updateKeyword(submitData).then(response => {
|
|
this.msgSuccess("修改成功");
|
|
this.msgSuccess("修改成功");
|
|
this.open = false;
|
|
this.open = false;
|
|
this.getList();
|
|
this.getList();
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
- addKeyword(this.form).then(response => {
|
|
|
|
|
|
+ addKeyword(submitData).then(response => {
|
|
this.msgSuccess("新增成功");
|
|
this.msgSuccess("新增成功");
|
|
this.open = false;
|
|
this.open = false;
|
|
this.getList();
|
|
this.getList();
|
|
@@ -260,7 +293,7 @@ export default {
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
handleDelete(row) {
|
|
const keywordIds = row.keywordId || this.ids;
|
|
const keywordIds = row.keywordId || this.ids;
|
|
- this.$confirm('是否确认删除系统关键字编号为"' + keywordIds + '"的数据项?', "警告", {
|
|
|
|
|
|
+ this.$confirm('是否确认删除该数据?', "警告", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
type: "warning"
|
|
@@ -274,7 +307,7 @@ export default {
|
|
/** 导出按钮操作 */
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
handleExport() {
|
|
const queryParams = this.queryParams;
|
|
const queryParams = this.queryParams;
|
|
- this.$confirm('是否确认导出所有系统关键字数据项?', "警告", {
|
|
|
|
|
|
+ this.$confirm('是否确认导出所有关键字数据项?', "警告", {
|
|
confirmButtonText: "确定",
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
type: "warning"
|
|
type: "warning"
|
|
@@ -285,6 +318,18 @@ export default {
|
|
this.download(response.msg);
|
|
this.download(response.msg);
|
|
this.exportLoading = false;
|
|
this.exportLoading = false;
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ /** 获取类型选项 */
|
|
|
|
+ getTypeOptions() {
|
|
|
|
+ allList({ dictType: "keyword_type" }).then(response => {
|
|
|
|
+ this.typeOptions = response.data;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 获取公司选项 */
|
|
|
|
+ getCompanyOptions() {
|
|
|
|
+ getCompanyList().then(response => {
|
|
|
|
+ this.companys = response.data;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|