pzy 3 years ago
parent
commit
dc3f7788e6
  1. 133
      src/views/article/subject/article.vue

133
src/views/article/subject/article.vue

@ -1,44 +1,45 @@
<template>
<div class="app-container">
<el-form
ref="queryForm"
:model="listQuery"
:inline="true"
label-width="68px"
>
<el-form-item label="专题" prop="special_id">
<el-select
v-model="listQuery.special_id"
placeholder="专题"
clearable
size="small"
style="width: 160px"
>
<el-option
v-for="dict in subject"
:key="dict.special_id"
:label="dict.title"
:value="dict.special_id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="getList"
>搜索</el-button
>
</el-form-item>
</el-form>
ref="queryForm"
:model="listQuery"
:inline="true"
label-width="68px"
>
<el-form-item label="专题" prop="special_id">
<el-select
v-model="listQuery.special_id"
placeholder="专题"
clearable
size="small"
style="width: 160px"
>
<el-option
v-for="dict in subject"
:key="dict.special_id"
:label="dict.title"
:value="dict.special_id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="getList"
>搜索</el-button
>
</el-form-item>
</el-form>
<div class="filter-container">
<el-button
class="filter-item el-button el-button--primary el-button--mini"
type="primary"
icon="el-icon-edit"
@click="handleCreate"
>添加文章</el-button>
>添加文章</el-button
>
</div>
<el-table
:key="tableKey"
@ -163,9 +164,7 @@ import {
delSubjectArticle,
} from "@/api/subject";
import {
searchArticle,
} from "@/api/ad";
import { searchArticle } from "@/api/ad";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -181,7 +180,7 @@ export default {
listQuery: {
page: 1,
limit: 20,
special_id: undefined
special_id: undefined,
},
subject: [],
uploadAction: process.env.VUE_APP_BASE_API + "/files/uploadFile",
@ -208,7 +207,7 @@ export default {
};
},
created() {
this.getSubjectList()
this.getSubjectList();
this.getList();
},
filters: {
@ -253,9 +252,9 @@ export default {
},
resetTemp() {
this.temp = {
id: undefined,
special_id: undefined,
article_id: undefined,
id: undefined,
special_id: undefined,
article_id: undefined,
};
},
submitForm() {
@ -285,33 +284,33 @@ export default {
// }
// })
},
handleDelete({ article_title, article_id, special_id }) {
this.$confirm('是否确认删除名称为"' + article_title + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delSubjectArticle({ article_id, special_id });
})
.then((response) => {
if (response.code === 200) {
this.$message({
message: "删除成功",
type: "success",
duration: 2 * 1000,
});
this.open = false;
this.getList();
} else {
this.$message({
message: "删除失败",
type: "error",
duration: 2 * 1000,
});
}
})
.catch(function () {});
async handleDelete({ article_title, article_id, special_id }) {
let confirm = this.$confirm(
'是否确认删除名称为"' + article_title + '"的数据项?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
);
console.log(1);
let r = await delSubjectArticle({ article_id, special_id });
if (r.code === 200) {
this.$message({
message: "删除成功",
type: "success",
duration: 2 * 1000,
});
this.open = false;
this.getList();
} else {
this.$message({
message: "删除失败",
type: "error",
duration: 2 * 1000,
});
}
},
handleSelectBranch(item) {

Loading…
Cancel
Save