This commit is contained in:
clay
2022-12-08 15:40:33 +08:00
parent 0a2a804ca8
commit 2cfbfef8bd
5 changed files with 348 additions and 243 deletions

View File

@@ -2,11 +2,11 @@
ENV = 'development'
# EBTS/开发环境
#VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = '/dev-api'
#VUE_APP_BASE_API = 'http://192.168.190.67/dev-api'
#VUE_APP_BASE_API = 'http://127.0.0.1:8085/dev-api'
#VUE_APP_BASE_API = 'http://sistapi.hchyun.cn/dev-api'
VUE_APP_BASE_API = 'http://sist.swjtu.edu.cn/dev-api'
#VUE_APP_BASE_API = 'http://sist.swjtu.edu.cn/dev-api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@@ -133,10 +133,10 @@ export default {
},
mounted() {
this.initInform()
let notice_text = document.getElementById('notice_text')
notice_text.addEventListener('webkitAnimationEnd', function() {
this.style.marginLeft = 0
}, false)
// let notice_text = document.getElementById('notice_text')
// notice_text.addEventListener('webkitAnimationEnd', function() {
// this.style.marginLeft = 0
// }, false)
// this.initFiche()
},
methods: {

View File

@@ -16,7 +16,8 @@
type="textarea"
:rows="4"
placeholder="请输入内容"
clearable :style="{width: '100%'}">
clearable :style="{width: '100%'}"
>
</el-input>
</el-form-item>
</el-col>
@@ -26,7 +27,8 @@
<el-form-item label="是否新闻" prop="isTop">
<el-radio-group v-model="formData.isTop">
<el-radio-button v-for="(item, index) in isTopOptions" :key="index"
:label="item.dictValue">{{ item.dictLabel }}
:label="item.dictValue"
>{{ item.dictLabel }}
</el-radio-button>
</el-radio-group>
</el-form-item>
@@ -44,7 +46,8 @@
<el-form-item label="是否英语" prop="isEnglish">
<el-radio-group v-model="formData.isEnglish">
<el-radio-button v-for="(item, index) in isEnglishOptions" :key="index"
:label="item.dictValue">{{ item.dictLabel }}
:label="item.dictValue"
>{{ item.dictLabel }}
</el-radio-button>
</el-radio-group>
</el-form-item>
@@ -56,7 +59,8 @@
<el-col :span="12">
<el-form-item label="信息网站">
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
placeholder="请选择文章类型" clearable :style="{width: '100%'}">
placeholder="请选择文章类型" clearable :style="{width: '100%'}"
>
<el-option
v-for="dict in sistArticleTypeOption"
:key="dict.id"
@@ -83,7 +87,8 @@
<el-col :span="12">
<el-form-item label="实验室网站">
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}">
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}"
>
<el-option
v-for="dict in labArticleTypeOption"
:key="dict.id"
@@ -146,7 +151,8 @@
<el-col :span="24" class="submitForm">
<el-form-item size="large">
<el-button type="success" @click="saveDrafts">保存草稿</el-button>
<el-button type="primary" @click="submitForm">{{(isAuditShow.sist || isAuditShow.lab) ? "提交审核":"发布"}}</el-button>
<el-button type="primary" @click="submitForm">{{ (isAuditShow.sist || isAuditShow.lab) ? '提交审核' : '发布' }}
</el-button>
</el-form-item>
</el-col>
</el-row>
@@ -155,18 +161,17 @@
</template>
<script>
import TinymceEditor from '@/views/utils/tinymce/Tinymce'
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
import {Message} from "element-ui";
import UploadFile from '@/views/utils/uploadFile.vue';
import { updateArticle, getArticle, drafts, getArticleApprove } from '@/api/sist/article'
import { Message } from 'element-ui'
import UploadFile from '@/views/utils/uploadFile.vue'
import { getArticleNav } from '../../../../api/sist/article'
import { getToken } from '../../../../utils/auth'
import { addFile, delFile } from '../../../../api/sist/file'
export default {
components: {
TinymceEditor,
UploadFile,
UploadFile
// ArticleFile
},
props: [],
@@ -186,12 +191,12 @@ export default {
title: null,
isTop: '2',
isEnglish: '0',
content: "",
imgurl:null,
content: '',
imgurl: null
},
approveShow: {
sist: true,
lab: true,
lab: true
},
isAuditShow: {
sist: false,
@@ -201,7 +206,7 @@ export default {
sistArticleType: null,
sistApprove: null,
labArticleType: null,
labApprove: null,
labApprove: null
},
sistArticleTypeOption: [],
labArticleTypeOption: [],
@@ -247,8 +252,8 @@ export default {
required: true,
message: '请选择发布日期',
trigger: 'change'
}],
},
}]
}
}
},
computed: {},
@@ -258,9 +263,9 @@ export default {
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) {
this.formData.id = null;
this.formData.id = null
} else {
getArticle(this.formData.id).then(response => {
this.formData = response.data
@@ -279,21 +284,21 @@ export default {
}
})
}
this.getDicts("article_site_type").then(response => {
this.sitetypeOptions = response.data;
});
this.getDicts("is_top").then(response => {
this.isTopOptions = response.data;
});
this.getDicts("is_view").then(response => {
this.isViewOptions = response.data;
});
this.getDicts("is_english").then(response => {
this.isEnglishOptions = response.data;
});
this.getDicts("article_status").then(response => {
this.statusOptions = response.data;
});
this.getDicts('article_site_type').then(response => {
this.sitetypeOptions = response.data
})
this.getDicts('is_top').then(response => {
this.isTopOptions = response.data
})
this.getDicts('is_view').then(response => {
this.isViewOptions = response.data
})
this.getDicts('is_english').then(response => {
this.isEnglishOptions = response.data
})
this.getDicts('article_status').then(response => {
this.statusOptions = response.data
})
getArticleNav().then(res => {
let data = res.data
this.articleTypeOptions = data
@@ -343,10 +348,10 @@ export default {
id: dataFile.fileId,
uid: file.uid,
url: dataFile.url,
fileName:data.fileName,
fileName: data.fileName
}
let url = dataFile.uri
url = url.replace("/pubfiles","/attached")
url = url.replace('/pubfiles', '/attached')
let fileStr = '<p><a target="_blank" href="' + url + '">' + mapperItem.fileName + '</a><br/></p>'
this.formData.content = this.formData.content + fileStr
this.fileMapper.push(mapperItem)
@@ -403,22 +408,22 @@ export default {
let that_ = this
this.$refs['elForm'].validate(valid => {
if (valid) {
if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType === null || that_.params.labArticleType === "")) {
if ((that_.params.sistArticleType === null || that_.params.sistArticleType === '') && (that_.params.labArticleType === null || that_.params.labArticleType === '')) {
Message({
message: "请至少选择一个网站发布文章",
type: "error",
message: '请至少选择一个网站发布文章',
type: 'error'
})
return
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType !== null || that_.params.labArticleType !== "") && (that_.formData.sistApprove === null || that_.params.sistApprove === "")) {
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === '') && (that_.params.labArticleType !== null || that_.params.labArticleType !== '') && (that_.formData.sistApprove === null || that_.params.sistApprove === '')) {
Message({
message: "请选择信息网站的审批人",
type: "error",
message: '请选择信息网站的审批人',
type: 'error'
})
return
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType != null || that_.params.labArticleType !== "") && (that_.params.labApprove === null || that_.params.labApprove === "")) {
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === '') && (that_.params.labArticleType != null || that_.params.labArticleType !== '') && (that_.params.labApprove === null || that_.params.labApprove === '')) {
Message({
message: "请选择实验室网站的审批人",
type: "error",
message: '请选择实验室网站的审批人',
type: 'error'
})
return
}
@@ -426,49 +431,49 @@ export default {
that_.formData.params = that_.params
if (that_.submit == 0) {
Message({
message: "您操作过快",
type: "error",
message: '您操作过快',
type: 'error'
})
} else {
that_.submit = 0
that_.loading = true;
that_.loading = true
// this.formData.imgurl = this.form.imgurl.url
updateArticle(that_.formData).then(response => {
that_.loading = false;
that_.loading = false
if (response.code == 200) {
that_.msgSuccess("提交审批成功");
that_.msgSuccess('提交审批成功')
that_.submit = 1
that_.close();
that_.close()
}
}).catch(e => {
that_.submit = 1
});
})
}
// TODO 提交表单
})
},
close() {
this.$store.dispatch("tagsView/delView", this.$route);
this.$router.push({path: "/SIST/article/", query: {t: Date.now()}})
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(that.formData).then(res => {
if (that.formData.id == null || this.formData.id == "") {
if (that.formData.id == null || this.formData.id == '') {
that.formData.id = res.data
}
if (res.code == 200) {
that.msgSuccess('保存成功');
that.msgSuccess('保存成功')
} else {
that.Message({
message: res.code,
type: "error"
type: 'error'
})
}
})
})
},
}
}
}

View File

@@ -44,7 +44,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:notice:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -55,7 +56,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:notice:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -66,7 +68,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:notice:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -108,14 +111,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:notice:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:notice:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -161,11 +166,36 @@
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="24">
<el-form-item label="内容">
<el-form-item label="公告标题" prop="noticeContent">
<el-row>
<el-col :offset="1" :span="22">
<el-upload
class="upload-demo"
ref="upload"
:action="uploadFileUrl"
:headers="headers"
:on-remove="handleRemove"
:on-success="handleUploadSuccess"
:file-list="fileList"
:auto-upload="true"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
</el-upload>
</el-col>
</el-row>
<el-row>
<el-col :offset="1" :span="22">
<!-- <TinymceEditor ref="tinymce" v-model="form.noticeContent"></TinymceEditor>-->
<editor v-model="form.noticeContent" :min-height="192"/>
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
<!-- <TinymceEditor v-model="form.noticeContent"></TinymceEditor>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@@ -176,16 +206,24 @@
</template>
<script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice, exportNotice } from "@/api/system/notice";
import Editor from '@/components/Editor';
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice'
import Editor from '@/components/Editor'
import { addFile, delFile } from '../../../api/sist/file'
import { getToken } from '../../../utils/auth'
export default {
name: "Notice",
name: 'Notice',
components: {
Editor
},
data() {
return {
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
headers: {
Authorization: 'Bearer ' + getToken()
},
fileList: [],
fileMapper: [],
// 遮罩层
loading: true,
// 选中数组
@@ -201,7 +239,7 @@ export default {
// 公告表格数据
noticeList: [],
// 弹出层标题
title: "",
title: '',
// 是否显示弹出层
open: false,
// 类型数据字典
@@ -217,70 +255,121 @@ export default {
status: undefined
},
// 表单参数
form: {},
form: {
noticeId: undefined,
noticeTitle: undefined,
noticeType: '2',
noticeContent: undefined,
status: '0'
},
// 表单校验
rules: {
noticeTitle: [
{ required: true, message: "公告标题不能为空", trigger: "blur" }
{ required: true, message: '公告标题不能为空', trigger: 'blur' }
],
noticeType: [
{ required: true, message: "公告类型不能为空", trigger: "blur" }
{ required: true, message: '公告类型不能为空', trigger: 'blur' }
]
}
};
}
},
created() {
this.getList();
this.getDicts("sys_notice_status").then(response => {
this.statusOptions = response.data;
});
this.getDicts("sys_notice_type").then(response => {
this.typeOptions = response.data;
});
this.getList()
this.getDicts('sys_notice_status').then(response => {
this.statusOptions = response.data
})
this.getDicts('sys_notice_type').then(response => {
this.typeOptions = response.data
})
},
methods: {
handleRemove(file, fileList) {
let fileId = null
let index = 0
for (let item of this.fileMapper) {
console.log(file.uid, item)
if (file.uid == item.uid) {
fileId = item.id
break
}
index++
}
console.log(index)
let that = this
delFile(fileId).then(res => {
that.fileMapper.splice(index, 1)
console.log(that.fileMapper)
that.$message.success('提交成功!')
})
},
// 上传成功回调
handleUploadSuccess(res, file) {
let data = {
isPublic: '1',
fileType: '',
fileName: res.fileName,
fileAddr: res.fileAddr
}
addFile(data).then(res => {
console.log(res)
let dataFile = res.data
let mapperItem = {
id: dataFile.fileId,
uid: file.uid,
url: dataFile.url,
fileName: data.fileName
}
let url = dataFile.uri
url = url.replace('/pubfiles', '/attached')
let fileStr = '<p><a style="color: blue;text-decoration: underline;" target="_blank" href="' + url + '">' + mapperItem.fileName + '</a><br/></p>'
this.form.noticeContent = this.form.noticeContent + fileStr
this.fileMapper.push(mapperItem)
})
this.$message.success('提交成功!')
},
/** 查询公告列表 */
getList() {
this.loading = true;
this.loading = true
listNotice(this.queryParams).then(response => {
this.noticeList = response.rows;
this.total = response.total;
this.loading = false;
});
this.noticeList = response.rows
this.total = response.total
this.loading = false
})
},
// 公告状态字典翻译
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
return this.selectDictLabel(this.statusOptions, row.status)
},
// 公告状态字典翻译
typeFormat(row, column) {
return this.selectDictLabel(this.typeOptions, row.noticeType);
return this.selectDictLabel(this.typeOptions, row.noticeType)
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
noticeId: undefined,
noticeTitle: undefined,
noticeType: "2",
noticeType: '2',
noticeContent: undefined,
status: "0",
};
this.resetForm("form");
status: '0'
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
@@ -290,58 +379,58 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加公告";
this.reset()
this.open = true
this.title = '添加公告'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.reset()
const noticeId = row.noticeId || this.ids
getNotice(noticeId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改公告";
});
this.form = response.data
this.open = true
this.title = '修改公告'
})
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {
this.form.noticeType = "1"
this.form.status = "0"
this.$refs['form'].validate(valid => {
this.form.noticeType = '1'
this.form.status = '0'
if (valid) {
if (this.form.noticeId != undefined) {
updateNotice(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
this.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addNotice(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
this.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
});
})
},
/** 删除按钮操作 */
handleDelete(row) {
const noticeIds = row.noticeId || this.ids
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return delNotice(noticeIds);
return delNotice(noticeIds)
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
this.getList()
this.msgSuccess('删除成功')
})
}
}
};
}
</script>
<style scoped>
/deep/ .w-e-text {

View File

@@ -174,19 +174,29 @@ export default {
}
},
mounted() {
this.initTinymce()
// tinymce.init({
// images_upload_handler: (blobInfo, success, failure) => {
// this.upload_handler(blobInfo, success, failure)
// }
// })
},
// created() {
// this.initTinymce()
// tinymce.init({
// images_upload_handler: (blobInfo, success, failure) => {
// this.upload_handler(blobInfo, success, failure)
// }
// })
// },
methods: {
initTinymce(){
tinymce.init({
images_upload_handler: (blobInfo, success, failure) => {
this.upload_handler(blobInfo, success, failure)
}
})
},
// created() {
// tinymce.init({})
// },
methods: {
upload_handler(blobInfo, success, failure) {
console.log('我被触发了')
console.log(blobInfo, 'blobInfo')
@@ -216,6 +226,7 @@ export default {
},
watch: {
value(newValue) {
// this.initTinymce()
this.myValue = newValue
},
myValue(newValue) {