|
@@ -14,6 +14,21 @@
|
|
|
placeholder="请输入标题"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="类型" prop="title">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.type"
|
|
|
+ placeholder="请选择新闻状态"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="t in typeList"
|
|
|
+ :key="t.value"
|
|
|
+ :label="t.label"
|
|
|
+ :value="t.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="新闻状态" prop="status">
|
|
|
<el-select
|
|
|
v-model="queryParams.status"
|
|
@@ -116,6 +131,21 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="类型" align="center" prop="type" width="250">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div
|
|
|
+ style="
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ searchType(scope.row.type) }}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column
|
|
|
label="编辑日期"
|
|
|
align="center"
|
|
@@ -172,7 +202,7 @@
|
|
|
><el-tag type="warning">审核中</el-tag></span
|
|
|
>
|
|
|
<span v-if="scope.row.status == 2"
|
|
|
- ><el-tag type="info">审核驳回</el-tag></span
|
|
|
+ ><el-tag type="danger">审核驳回</el-tag></span
|
|
|
>
|
|
|
<span v-if="scope.row.status == 3"
|
|
|
><el-tag type="success">已审核</el-tag></span
|
|
@@ -181,7 +211,7 @@
|
|
|
><el-tag type="success">已发布</el-tag></span
|
|
|
>
|
|
|
<span v-if="scope.row.status == 5"
|
|
|
- ><el-tag type="danger">已下架</el-tag></span
|
|
|
+ ><el-tag type="info">已下架</el-tag></span
|
|
|
>
|
|
|
<span v-if="scope.row.status == 6"><el-tag>已置顶</el-tag></span>
|
|
|
</template>
|
|
@@ -200,8 +230,22 @@
|
|
|
v-hasPermi="['business:NEWS:remove']"
|
|
|
>下架</el-button
|
|
|
>
|
|
|
+ <el-popconfirm
|
|
|
+ title="确定提交审核吗?"
|
|
|
+ @confirm="handleCommit(scope.row.id)"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ slot="reference"
|
|
|
+ v-if="scope.row.status == 0 || scope.row.status == 2"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ v-hasPermi="['business:NEWS:remove']"
|
|
|
+ >提交审核</el-button
|
|
|
+ >
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
<el-button
|
|
|
- v-if="scope.row.status == 0 || scope.row.status == 2"
|
|
|
+ v-if="scope.row.status == 0 || scope.row.status == 2 || scope.row.status == 5"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
@click="handleUpdate(scope.row)"
|
|
@@ -209,7 +253,7 @@
|
|
|
>修改</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="scope.row.status == 5"
|
|
|
+ v-if="scope.row.status == 5 || scope.row.status == 3"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
@click="handleDownOrUp(scope.row)"
|
|
@@ -225,7 +269,7 @@
|
|
|
>取消置顶</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-else
|
|
|
+ v-else-if="scope.row.status == 4"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
@click="hanleTop(scope.row)"
|
|
@@ -256,6 +300,18 @@
|
|
|
<el-input v-model="form.title" placeholder="请输入标题"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
+ <el-select v-model="form.type" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in typeList"
|
|
|
+ :key="item.value + 'typeList'"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item label="封面图" prop="picture">
|
|
|
<el-upload
|
|
|
action="#"
|
|
@@ -308,6 +364,7 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="info" @click="submitzc">暂 存</el-button>
|
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
@@ -328,12 +385,19 @@ import {
|
|
|
updateNEWS,
|
|
|
upload,
|
|
|
setTop,
|
|
|
+ newCommit,
|
|
|
} from "@/api/portal/news/NEWS.js";
|
|
|
|
|
|
export default {
|
|
|
name: "NEWS",
|
|
|
data() {
|
|
|
return {
|
|
|
+ typeList: [
|
|
|
+ { label: "要闻咨询", value: "1" },
|
|
|
+ { label: "政策法规", value: "2" },
|
|
|
+ { label: "通知公告", value: "3" },
|
|
|
+ { label: "政策解读", value: "4" },
|
|
|
+ ],
|
|
|
fileList: [],
|
|
|
dialogVisible: false,
|
|
|
disabled: false,
|
|
@@ -371,7 +435,7 @@ export default {
|
|
|
title: null,
|
|
|
content: null,
|
|
|
fileUrl: null,
|
|
|
- type: 1, //要闻资讯
|
|
|
+ type: null,
|
|
|
typeName: null,
|
|
|
picture: null,
|
|
|
status: null,
|
|
@@ -386,8 +450,7 @@ export default {
|
|
|
type: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message:
|
|
|
- "字典类型id(1.要闻咨询,2.政策法规,3.通知公告,4.政策解读)不能为空",
|
|
|
+ message: "类型不能为空",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
@@ -420,14 +483,14 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
hanleTop(row) {
|
|
|
- var data = new FormData()
|
|
|
+ var data = new FormData();
|
|
|
//判断是否置顶
|
|
|
if (row.status == "6") {
|
|
|
- data.append('status',4)
|
|
|
+ data.append("status", 4);
|
|
|
} else {
|
|
|
- data.append('status',6)
|
|
|
+ data.append("status", 6);
|
|
|
}
|
|
|
- data.append('id',row.id)
|
|
|
+ data.append("id", row.id);
|
|
|
setTop(data).then((res) => {
|
|
|
this.getList();
|
|
|
});
|
|
@@ -463,24 +526,24 @@ export default {
|
|
|
},
|
|
|
handleDownOrUp(row) {
|
|
|
//修改发布、下架状态
|
|
|
- if (row.status == '4') {
|
|
|
- //已发布
|
|
|
- row.status = '5'
|
|
|
+ if (row.status == "4" || row.status == "3") {
|
|
|
+ //已发布 已审核
|
|
|
+ row.status = "5";
|
|
|
updateNEWS(row).then((response) => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
+ this.$modal.msgSuccess("发布成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
this.reset();
|
|
|
- })
|
|
|
- } else if (row.status == '5') {
|
|
|
+ });
|
|
|
+ } else if (row.status == "5") {
|
|
|
//已下架
|
|
|
- row.status = '4'
|
|
|
+ row.status = "4";
|
|
|
updateNEWS(row).then((response) => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
+ this.$modal.msgSuccess("下架成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
this.reset();
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 取消按钮
|
|
@@ -512,6 +575,9 @@ export default {
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
+ this.queryParams.type = "";
|
|
|
+ this.queryParams.title = "";
|
|
|
+ this.queryParams.status = "";
|
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
@@ -540,10 +606,19 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ handleCommit(id) {
|
|
|
+ let data = new FormData();
|
|
|
+ data.append("id", id);
|
|
|
+ newCommit(data).then((response) => {
|
|
|
+ this.$modal.msgSuccess("提交审核成功!");
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ },
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+ this.form.status = "1";
|
|
|
if (this.form.id != null) {
|
|
|
updateNEWS(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
@@ -553,15 +628,38 @@ export default {
|
|
|
});
|
|
|
} else {
|
|
|
addNEWS(this.form).then((response) => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- this.reset();
|
|
|
+ handleCommit(id).then((res) => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ this.reset();
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ searchType(id) {
|
|
|
+ let fined = this.typeList.find((item) => item.value == id);
|
|
|
+ if (fined.label != undefined) {
|
|
|
+ return fined.label;
|
|
|
+ } else {
|
|
|
+ return "未选择类型!";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submitzc() {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.form.status = "0";
|
|
|
+ addNEWS(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("暂存成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ this.reset();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|