文章业务
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
<el-date-picker
|
||||
v-model="publishTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择日期时间"
|
||||
align="right"
|
||||
:picker-options="pickerOptions">
|
||||
@@ -119,7 +120,7 @@ import Editor from '@/views/utils/Editor'
|
||||
this.isEnglishOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
methods: {
|
||||
submitForm(type) {
|
||||
let that = this
|
||||
if (type === "approve") {
|
||||
@@ -158,12 +159,22 @@ import Editor from '@/views/utils/Editor'
|
||||
publishTime: this.publishTime,
|
||||
}
|
||||
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() {
|
||||
rejected(this.article.id).then(res => {
|
||||
console.log(res);
|
||||
if (res.code==200){
|
||||
this.msgSuccess("驳回成功并以邮件告知!")
|
||||
this.close();
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="sistArticleTypeOption.length>0">
|
||||
<el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="信息网站">
|
||||
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
|
||||
@@ -83,7 +83,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="labArticleTypeOption.length>0">
|
||||
<el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="实验室网站">
|
||||
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
|
||||
@@ -120,7 +120,6 @@
|
||||
<el-form-item size="large">
|
||||
<el-button type="success" @click="saveDrafts">保存草稿</el-button>
|
||||
<el-button type="primary" @click="submitForm">提交审核</el-button>
|
||||
<el-button @click="resetForm">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -139,6 +138,7 @@ export default {
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
submit: 1,
|
||||
formData: {
|
||||
id: null,
|
||||
title: null,
|
||||
@@ -146,6 +146,10 @@ export default {
|
||||
isEnglish: null,
|
||||
content: "",
|
||||
},
|
||||
approveShow: {
|
||||
sist: true,
|
||||
lab: true,
|
||||
},
|
||||
params: {
|
||||
sistArticleType: null,
|
||||
sistApprove: null,
|
||||
@@ -198,19 +202,31 @@ export default {
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
this.approveShow = {
|
||||
sist: true,
|
||||
lab: true
|
||||
}
|
||||
this.formData.id = this.$route.params && this.$route.params.articleId;
|
||||
if (this.formData.id === undefined) {
|
||||
this.formData.id = null;
|
||||
this.formData.sitetype
|
||||
} else {
|
||||
getArticle(this.formData.id).then(response => {
|
||||
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.sitetypeOptions = response.data;
|
||||
});
|
||||
this.getEncodeDicts("article_type").then(response => {
|
||||
this.getDicts("article_type").then(response => {
|
||||
this.articleTypeOptions = response.data;
|
||||
});
|
||||
this.getDicts("is_top").then(response => {
|
||||
@@ -228,6 +244,7 @@ export default {
|
||||
getArticleType().then(res => {
|
||||
let dictCodes = res.data
|
||||
let articleList = this.articleTypeOptions
|
||||
console.log(articleList, dictCodes);
|
||||
for (let i = 0; i < articleList.length; i++) {
|
||||
for (let j = 0; j < dictCodes.length; 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 === "")) {
|
||||
Message({
|
||||
message: "请至少选择一个网站发布文章",
|
||||
type: 'error'
|
||||
type: "error",
|
||||
})
|
||||
this.msgSuccess("请至少选择一个网站发布文章")
|
||||
return
|
||||
} 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: "请选择信息网站的审批人",
|
||||
type: 'error'
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
} 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: "请选择实验室网站的审批人",
|
||||
type: 'error'
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
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 => {
|
||||
this.msgSuccess("提交审批成功");
|
||||
this.$router.push("/sist/article");
|
||||
this.loading = false;
|
||||
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 提交表单
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({path: "/SIST/article/", query: {t: Date.now()}})
|
||||
},
|
||||
saveDrafts() {
|
||||
let that_ = this
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
drafts(this.formData).then(res=>{
|
||||
if (this.formData.id === null || this.formData.id === ""){
|
||||
drafts(this.formData).then(res => {
|
||||
if (this.formData.id == null || this.formData.id == "") {
|
||||
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>
|
||||
<style>
|
||||
.el-select-dropdown{
|
||||
z-index: 2147483647!important;
|
||||
.el-select-dropdown, .el-message {
|
||||
z-index: 2147483647 !important;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -141,6 +141,11 @@
|
||||
<!-- disable-transitions>完成-->
|
||||
<!-- </el-tag>-->
|
||||
<!-- </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">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.publishTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
@@ -148,7 +153,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||
<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
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -166,13 +171,20 @@
|
||||
>删除
|
||||
</el-button>
|
||||
</span>
|
||||
<el-button v-show="scope.row.approvalUserId===userId"
|
||||
<el-button v-show="scope.row.approvalUserId===userId && scope.row.status === '2'"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleApprova(scope.row)"
|
||||
>审批
|
||||
</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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -188,7 +200,7 @@
|
||||
</template>
|
||||
|
||||
<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 store from "@/store";
|
||||
|
||||
@@ -283,7 +295,7 @@ export default {
|
||||
this.getDicts("article_site_type").then(response => {
|
||||
this.siteTypeOptions = response.data;
|
||||
});
|
||||
this.getEncodeDicts("article_type").then(response => {
|
||||
this.getDicts("article_type").then(response => {
|
||||
this.articleTypeOptions = response.data;
|
||||
});
|
||||
this.getDicts("is_top").then(response => {
|
||||
@@ -299,6 +311,9 @@ export default {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
},
|
||||
activated(){
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询系统文章列表 */
|
||||
getList() {
|
||||
@@ -366,6 +381,23 @@ export default {
|
||||
handleApprova(row) {
|
||||
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) {
|
||||
const ids = row.id || this.ids;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="delflag">
|
||||
|
||||
<el-input
|
||||
v-model="queryParams.delflag"
|
||||
placeholder="请输入状态"
|
||||
@@ -149,7 +148,6 @@
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
|
||||
Reference in New Issue
Block a user