From f213b292d028a38828fe7d623d1dd985edfbd5d6 Mon Sep 17 00:00:00 2001 From: clay <20932067@zju.edu.cn> Date: Mon, 10 Jan 2022 00:12:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebts-ui/src/api/sist/article.js | 11 ++- ebts-ui/src/components/Editor/index.vue | 2 + ebts-ui/src/views/login.vue | 2 +- .../views/sist/article/components/approve.vue | 17 +++- .../views/sist/article/components/article.vue | 87 +++++++++++++------ ebts-ui/src/views/sist/article/index.vue | 40 ++++++++- ebts-ui/src/views/sist/banner/index.vue | 2 - ebts-ui/src/views/system/dept/index.vue | 30 +++---- ebts-ui/src/views/system/user/index.vue | 68 +++++++-------- 9 files changed, 172 insertions(+), 87 deletions(-) diff --git a/ebts-ui/src/api/sist/article.js b/ebts-ui/src/api/sist/article.js index d58bfaa..495c721 100644 --- a/ebts-ui/src/api/sist/article.js +++ b/ebts-ui/src/api/sist/article.js @@ -29,7 +29,7 @@ export function getArticle(id) { // 查询系统文章详细 export function getArticleType() { return request({ - url: '/sist/article/type/', + url: '/sist/article/type', 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) { return request({ diff --git a/ebts-ui/src/components/Editor/index.vue b/ebts-ui/src/components/Editor/index.vue index 3dbbccf..1cf2f82 100644 --- a/ebts-ui/src/components/Editor/index.vue +++ b/ebts-ui/src/components/Editor/index.vue @@ -91,6 +91,8 @@ export default { this.editor = new Editor(this.$refs.editor) this.editor.config.uploadImgShowBase64 = true // 使用 base64 保存图片 this.editor.config.height = this.height + this.editor.config.pasteFilterStyle = false + this.editor.config.zIndex = 10 this.setMenus() // 设置菜单 this.editor.config.onchange = (html) => { _this.$emit('change', html) // 将内容同步到父组件中 diff --git a/ebts-ui/src/views/login.vue b/ebts-ui/src/views/login.vue index 669151f..7a7fc02 100644 --- a/ebts-ui/src/views/login.vue +++ b/ebts-ui/src/views/login.vue @@ -66,7 +66,7 @@ export default { codeUrl: "", cookiePassword: "", loginForm: { - username: "admin", + username: "superadmin", password: "926425", // username: "admin", // password: "HCY@2020", diff --git a/ebts-ui/src/views/sist/article/components/approve.vue b/ebts-ui/src/views/sist/article/components/approve.vue index 1423b97..668c0e7 100644 --- a/ebts-ui/src/views/sist/article/components/approve.vue +++ b/ebts-ui/src/views/sist/article/components/approve.vue @@ -42,6 +42,7 @@ @@ -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(); + } }) }, diff --git a/ebts-ui/src/views/sist/article/components/article.vue b/ebts-ui/src/views/sist/article/components/article.vue index 1cdd1c3..83416d0 100644 --- a/ebts-ui/src/views/sist/article/components/article.vue +++ b/ebts-ui/src/views/sist/article/components/article.vue @@ -56,7 +56,7 @@ - + - + 保存草稿 提交审核 - 重置 @@ -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() - }, } }