文章业务

This commit is contained in:
clay
2022-01-10 00:12:45 +08:00
parent 0e62e7e3da
commit f213b292d0
9 changed files with 172 additions and 87 deletions

View File

@@ -29,7 +29,7 @@ export function getArticle(id) {
// 查询系统文章详细 // 查询系统文章详细
export function getArticleType() { export function getArticleType() {
return request({ return request({
url: '/sist/article/type/', url: '/sist/article/type',
method: 'get' method: 'get'
}) })
} }
@@ -77,6 +77,15 @@ export function rejected(data) {
}) })
} }
// 驳回系统文章
export function offline(data) {
return request({
url: '/sist/article/offline',
method: 'post',
data
})
}
// 修改系统文章 // 修改系统文章
export function updateArticle(data) { export function updateArticle(data) {
return request({ return request({

View File

@@ -91,6 +91,8 @@ export default {
this.editor = new Editor(this.$refs.editor) this.editor = new Editor(this.$refs.editor)
this.editor.config.uploadImgShowBase64 = true // 使用 base64 保存图片 this.editor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
this.editor.config.height = this.height this.editor.config.height = this.height
this.editor.config.pasteFilterStyle = false
this.editor.config.zIndex = 10
this.setMenus() // 设置菜单 this.setMenus() // 设置菜单
this.editor.config.onchange = (html) => { this.editor.config.onchange = (html) => {
_this.$emit('change', html) // 将内容同步到父组件中 _this.$emit('change', html) // 将内容同步到父组件中

View File

@@ -66,7 +66,7 @@ export default {
codeUrl: "", codeUrl: "",
cookiePassword: "", cookiePassword: "",
loginForm: { loginForm: {
username: "admin", username: "superadmin",
password: "926425", password: "926425",
// username: "admin", // username: "admin",
// password: "HCY@2020", // password: "HCY@2020",

View File

@@ -42,6 +42,7 @@
<el-date-picker <el-date-picker
v-model="publishTime" v-model="publishTime"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间" placeholder="选择日期时间"
align="right" align="right"
:picker-options="pickerOptions"> :picker-options="pickerOptions">
@@ -119,7 +120,7 @@ import Editor from '@/views/utils/Editor'
this.isEnglishOptions = response.data; this.isEnglishOptions = response.data;
}); });
}, },
methods: { methods: {
submitForm(type) { submitForm(type) {
let that = this let that = this
if (type === "approve") { if (type === "approve") {
@@ -158,12 +159,22 @@ import Editor from '@/views/utils/Editor'
publishTime: this.publishTime, publishTime: this.publishTime,
} }
approve(this.fromData).then(res => { approve(this.fromData).then(res => {
console.log(res); if (res.code==200){
this.msgSuccess("审批通过")
this.close();
}
}) })
}, },
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({ path: "/SIST/article/", query: { t: Date.now()}})
},
toRejected() { toRejected() {
rejected(this.article.id).then(res => { rejected(this.article.id).then(res => {
console.log(res); if (res.code==200){
this.msgSuccess("驳回成功并以邮件告知!")
this.close();
}
}) })
}, },

View File

@@ -56,7 +56,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="sistArticleTypeOption.length>0"> <el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="信息网站"> <el-form-item label="信息网站">
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)" <el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
@@ -83,7 +83,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="labArticleTypeOption.length>0"> <el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="实验室网站"> <el-form-item label="实验室网站">
<el-select v-model="params.labArticleType" placeholder="请选择文章类型" <el-select v-model="params.labArticleType" placeholder="请选择文章类型"
@@ -120,7 +120,6 @@
<el-form-item size="large"> <el-form-item size="large">
<el-button type="success" @click="saveDrafts">保存草稿</el-button> <el-button type="success" @click="saveDrafts">保存草稿</el-button>
<el-button type="primary" @click="submitForm">提交审核</el-button> <el-button type="primary" @click="submitForm">提交审核</el-button>
<el-button @click="resetForm">重置</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -139,6 +138,7 @@ export default {
props: [], props: [],
data() { data() {
return { return {
submit: 1,
formData: { formData: {
id: null, id: null,
title: null, title: null,
@@ -146,6 +146,10 @@ export default {
isEnglish: null, isEnglish: null,
content: "", content: "",
}, },
approveShow: {
sist: true,
lab: true,
},
params: { params: {
sistArticleType: null, sistArticleType: null,
sistApprove: null, sistApprove: null,
@@ -198,19 +202,31 @@ export default {
computed: {}, computed: {},
watch: {}, watch: {},
created() { created() {
this.approveShow = {
sist: true,
lab: true
}
this.formData.id = this.$route.params && this.$route.params.articleId; this.formData.id = this.$route.params && this.$route.params.articleId;
if (this.formData.id === undefined) { if (this.formData.id === undefined) {
this.formData.id = null; this.formData.id = null;
this.formData.sitetype
} else { } else {
getArticle(this.formData.id).then(response => { getArticle(this.formData.id).then(response => {
this.formData = response.data this.formData = response.data
if (this.formData.siteType === '2') {
this.approveShow.sist = false
this.params.labArticleType = parseInt(this.formData.type)
this.getLabApprove(this.params.labArticleType)
} else if (this.formData.siteType === '1') {
this.approveShow.lab = false
this.params.sistArticleType = parseInt(this.formData.type)
this.getSistApprove(this.params.sistArticleType)
}
}) })
} }
this.getDicts("article_site_type").then(response => { this.getDicts("article_site_type").then(response => {
this.sitetypeOptions = response.data; this.sitetypeOptions = response.data;
}); });
this.getEncodeDicts("article_type").then(response => { this.getDicts("article_type").then(response => {
this.articleTypeOptions = response.data; this.articleTypeOptions = response.data;
}); });
this.getDicts("is_top").then(response => { this.getDicts("is_top").then(response => {
@@ -228,6 +244,7 @@ export default {
getArticleType().then(res => { getArticleType().then(res => {
let dictCodes = res.data let dictCodes = res.data
let articleList = this.articleTypeOptions let articleList = this.articleTypeOptions
console.log(articleList, dictCodes);
for (let i = 0; i < articleList.length; i++) { for (let i = 0; i < articleList.length; i++) {
for (let j = 0; j < dictCodes.length; j++) { for (let j = 0; j < dictCodes.length; j++) {
if (articleList[i].dictCode === dictCodes[j]) { if (articleList[i].dictCode === dictCodes[j]) {
@@ -261,58 +278,76 @@ export default {
if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType === null || this.params.labArticleType === "")) { if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType === null || this.params.labArticleType === "")) {
Message({ Message({
message: "请至少选择一个网站发布文章", message: "请至少选择一个网站发布文章",
type: 'error' type: "error",
}) })
this.msgSuccess("请至少选择一个网站发布文章")
return return
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType !== null || this.params.labArticleType !== "") && (this.formData.sistApprove === null || this.params.sistApprove === "")) { } else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType !== null || this.params.labArticleType !== "") && (this.formData.sistApprove === null || this.params.sistApprove === "")) {
this.msgSuccess({ Message({
message: "请选择信息网站的审批人", message: "请选择信息网站的审批人",
type: 'error' type: "error",
}) })
return return
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType != null || this.params.labArticleType !== "") && (this.params.labApprove === null || this.params.labApprove === "")) { } else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType != null || this.params.labArticleType !== "") && (this.params.labApprove === null || this.params.labApprove === "")) {
this.msgSuccess({ Message({
message: "请选择实验室网站的审批人", message: "请选择实验室网站的审批人",
type: 'error' type: "error",
}) })
return return
} }
} }
this.formData.params = this.params this.formData.params = this.params
if (this.formData.id != null) { if (this.submit == 0) {
Message({
message: "您操作过快",
type: "error",
})
} else {
this.submit = 0
this.loading = true;
updateArticle(this.formData).then(response => { updateArticle(this.formData).then(response => {
this.msgSuccess("提交审批成功"); this.loading = false;
this.$router.push("/sist/article"); if (response.code == 200) {
this.msgSuccess("提交审批成功");
this.submit = 1
this.close();
}
}).catch(e => {
this.submit = 1
}); });
// } else {
// addArticle(this.formData).then(response => {
// this.msgSuccess("新增成功");
// this.$router.push("/sist/article");
// });
} }
// TODO 提交表单 // TODO 提交表单
}) })
}, },
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({path: "/SIST/article/", query: {t: Date.now()}})
},
saveDrafts() { saveDrafts() {
let that_ = this
this.$refs['elForm'].validate(valid => { this.$refs['elForm'].validate(valid => {
drafts(this.formData).then(res=>{ drafts(this.formData).then(res => {
if (this.formData.id === null || this.formData.id === ""){ if (this.formData.id == null || this.formData.id == "") {
this.formData.id = res.data this.formData.id = res.data
} }
this.msgSuccess('保存成功'); if (res.code == 200) {
that_.msgSuccess('保存成功');
} else {
that_.Message({
message: res.code,
type: "error"
})
}
}) })
}) })
}, },
resetForm() {
this.$refs['elForm'].resetFields()
},
} }
} }
</script> </script>
<style> <style>
.el-select-dropdown{ .el-select-dropdown, .el-message {
z-index: 2147483647!important; z-index: 2147483647 !important;
} }
</style> </style>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@@ -141,6 +141,11 @@
<!-- disable-transitions>完成--> <!-- disable-transitions>完成-->
<!-- </el-tag>--> <!-- </el-tag>-->
<!-- </template>--> <!-- </template>-->
<el-table-column label="修改时间 " align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="发布时间 " align="center" prop="publishTime" width="180"> <el-table-column label="发布时间 " align="center" prop="publishTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> <span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
@@ -148,7 +153,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-show="scope.row.status === 'NEd5n92EMIpyyBslaNqsRgE'|| scope.row.status === 'N6CfFGz2UWpQ9Uhk3uwiJAQ'"> <span v-show="scope.row.status === '1'|| scope.row.status === '4'|| scope.row.status === '5'">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@@ -166,13 +171,20 @@
>删除 >删除
</el-button> </el-button>
</span> </span>
<el-button v-show="scope.row.approvalUserId===userId" <el-button v-show="scope.row.approvalUserId===userId && scope.row.status === '2'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleApprova(scope.row)" @click="handleApprova(scope.row)"
>审批 >审批
</el-button> </el-button>
<el-button v-show="scope.row.approvalUserId===userId && scope.row.status === '3'"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleOffline(scope.row)"
>下线
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -188,7 +200,7 @@
</template> </template>
<script> <script>
import {listArticle, delArticle, exportArticle,drafts} from "@/api/sist/article"; import {listArticle, delArticle, exportArticle,offline} from "@/api/sist/article";
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
import store from "@/store"; import store from "@/store";
@@ -283,7 +295,7 @@ export default {
this.getDicts("article_site_type").then(response => { this.getDicts("article_site_type").then(response => {
this.siteTypeOptions = response.data; this.siteTypeOptions = response.data;
}); });
this.getEncodeDicts("article_type").then(response => { this.getDicts("article_type").then(response => {
this.articleTypeOptions = response.data; this.articleTypeOptions = response.data;
}); });
this.getDicts("is_top").then(response => { this.getDicts("is_top").then(response => {
@@ -299,6 +311,9 @@ export default {
this.statusOptions = response.data; this.statusOptions = response.data;
}); });
}, },
activated(){
this.getList();
},
methods: { methods: {
/** 查询系统文章列表 */ /** 查询系统文章列表 */
getList() { getList() {
@@ -366,6 +381,23 @@ export default {
handleApprova(row) { handleApprova(row) {
this.$router.push("/article/approve/" + row.id); this.$router.push("/article/approve/" + row.id);
}, },
handleOffline(row){
let that_ = this
this.$confirm('是否确认下线标题为:"' + row.title + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function () {
that_.loading = true;
return offline(row.id);
}).then(res=>{
if (res.code==200){
this.msgSuccess("下线成功");
this.getList()
}
that_.loading = false;
})
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;

View File

@@ -22,7 +22,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="状态" prop="delflag"> <el-form-item label="状态" prop="delflag">
<el-input <el-input
v-model="queryParams.delflag" v-model="queryParams.delflag"
placeholder="请输入状态" placeholder="请输入状态"
@@ -149,7 +148,6 @@
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
<el-option label="请选择字典生成" value="" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">

View File

@@ -106,21 +106,21 @@
<el-input-number v-model="form.orderNum" controls-position="right" :min="0"/> <el-input-number v-model="form.orderNum" controls-position="right" :min="0"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="负责人" prop="leader"> <!-- <el-form-item label="负责人" prop="leader">-->
<el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20"/> <!-- <el-input v-model="form.leader" placeholder="请输入负责人" maxlength="20"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="联系电话" prop="phone"> <!-- <el-form-item label="联系电话" prop="phone">-->
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11"/> <!-- <el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="邮箱" prop="email"> <!-- <el-form-item label="邮箱" prop="email">-->
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50"/> <!-- <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50"/>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="部门状态"> <el-form-item label="部门状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">

View File

@@ -243,18 +243,18 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label="用户性别"> <!-- <el-form-item label="用户性别">-->
<el-select v-model="form.sex" placeholder="请选择"> <!-- <el-select v-model="form.sex" placeholder="请选择">-->
<el-option <!-- <el-option-->
v-for="dict in sexOptions" <!-- v-for="dict in sexOptions"-->
:key="dict.dictValue" <!-- :key="dict.dictValue"-->
:label="dict.dictLabel" <!-- :label="dict.dictLabel"-->
:value="dict.dictValue" <!-- :value="dict.dictValue"-->
></el-option> <!-- ></el-option>-->
</el-select> <!-- </el-select>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <el-col :span="12">
<el-form-item label="状态"> <el-form-item label="状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
@@ -266,21 +266,19 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> <!-- <el-col :span="12">-->
<el-row> <!-- <el-form-item label="岗位">-->
<el-col :span="12"> <!-- <el-select v-model="form.postIds" multiple placeholder="请选择">-->
<el-form-item label="岗位"> <!-- <el-option-->
<el-select v-model="form.postIds" multiple placeholder="请选择"> <!-- v-for="item in postOptions"-->
<el-option <!-- :key="item.postId"-->
v-for="item in postOptions" <!-- :label="item.postName"-->
:key="item.postId" <!-- :value="item.postId"-->
:label="item.postName" <!-- :disabled="item.status == 1"-->
:value="item.postId" <!-- ></el-option>-->
:disabled="item.status == 1" <!-- </el-select>-->
></el-option> <!-- </el-form-item>-->
</el-select> <!-- </el-col>-->
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="角色"> <el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择"> <el-select v-model="form.roleIds" multiple placeholder="请选择">
@@ -297,7 +295,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="文章类型"> <el-form-item label="内容审核权限">
<el-checkbox v-model="siteTypeNodeAll" @change="handleCheckedTreeNodeAll($event)">全选/全不选</el-checkbox> <el-checkbox v-model="siteTypeNodeAll" @change="handleCheckedTreeNodeAll($event)">全选/全不选</el-checkbox>
<el-checkbox v-model="siteTypeCheckStrictly" @change="handleCheckedTreeConnect($event)">父子联动 <el-checkbox v-model="siteTypeCheckStrictly" @change="handleCheckedTreeConnect($event)">父子联动
</el-checkbox> </el-checkbox>
@@ -314,13 +312,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <!-- <el-row>-->
<el-col :span="24"> <!-- <el-col :span="24">-->
<el-form-item label="备注"> <!-- <el-form-item label="备注">-->
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <!-- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
</el-row> <!-- </el-row>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>