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,25 +27,27 @@
<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>
</el-col>
<!-- <el-col :span="8">-->
<!-- <el-form-item label="是否显示" prop="isView">-->
<!-- <el-radio-group v-model="formData.isView">-->
<!-- <el-radio-button v-for="(item, index) in isViewOptions" :key="index"-->
<!-- :label="item.dictValue">{{ item.dictLabel }}-->
<!-- </el-radio-button>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8">-->
<!-- <el-form-item label="是否显示" prop="isView">-->
<!-- <el-radio-group v-model="formData.isView">-->
<!-- <el-radio-button v-for="(item, index) in isViewOptions" :key="index"-->
<!-- :label="item.dictValue">{{ item.dictLabel }}-->
<!-- </el-radio-button>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<el-col :span="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"
@@ -108,7 +113,7 @@
</el-row>
</el-col>
<el-col :span="12" v-show="imgurlShow">
<el-form-item >
<el-form-item>
<UploadFile v-model="formData.imgurl"
file-type="image"
:v-public="true"
@@ -132,7 +137,7 @@
:auto-upload="true"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>-->
</el-upload>
</el-col>
@@ -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,53 +161,52 @@
</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: [],
data() {
return {
isAdmin:false,
isAdmin: false,
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
headers: {
Authorization: 'Bearer ' + getToken()
},
fileList:[],
fileMapper:[],
fileList: [],
fileMapper: [],
submit: 1,
imgurlShow:false,
imgurlShow: false,
formData: {
id: null,
title: null,
isTop: '2',
isEnglish: '0',
content: "",
imgurl:null,
content: '',
imgurl: null
},
approveShow: {
sist: true,
lab: true,
lab: true
},
isAuditShow:{
sist:false,
lab:false
isAuditShow: {
sist: false,
lab: false
},
params: {
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,49 +263,49 @@ 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
if (this.formData.siteType === '2') {
this.approveShow.sist = false
if (null != this.formData.navId){
if (null != this.formData.navId) {
this.params.labArticleType = parseInt(this.formData.navId)
this.getLabApprove(this.params.labArticleType)
}
} else if (this.formData.siteType === '1') {
this.approveShow.lab = false
if (null != this.formData.navId){
if (null != this.formData.navId) {
this.params.sistArticleType = parseInt(this.formData.navId)
this.getSistApprove(this.params.sistArticleType)
}
}
})
}
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=>{
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
for (let item of data) {
if (item.sitetype == 1){
if (item.sitetype == 1) {
this.sistArticleTypeOption.push(item)
}else {
} else {
this.labArticleTypeOption.push(item)
}
}
@@ -333,7 +338,7 @@ export default {
let data = {
isPublic: '1',
fileType: '',
fileName:res.fileName,
fileName: res.fileName,
fileAddr: res.fileAddr
}
addFile(data).then(res => {
@@ -342,12 +347,12 @@ export default {
let mapperItem = {
id: dataFile.fileId,
uid: file.uid,
url:dataFile.url,
fileName:data.fileName,
url: dataFile.url,
fileName: data.fileName
}
let url = dataFile.uri
url = url.replace("/pubfiles","/attached")
let fileStr = '<p><a target="_blank" href="'+url+'">'+mapperItem.fileName+'</a><br/></p>'
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)
})
@@ -355,44 +360,44 @@ export default {
},
getSistApprove(navId) {
if (!navId){
if (!navId) {
return
}
this.isAuditShow.sist = false
this.auditShow(navId,1)
this.auditShow(navId, 1)
this.judgeThumbnail(navId)
getArticleApprove(navId).then(res => {
this.sistApproveOption = res.data
})
},
getLabApprove(navId) {
if (!navId){
if (!navId) {
return
}
this.isAuditShow.lab = false
this.auditShow(navId,2)
this.auditShow(navId, 2)
this.judgeThumbnail(navId)
getArticleApprove(navId).then(res => {
this.labApproveOption = res.data
})
},
judgeThumbnail(navId){
judgeThumbnail(navId) {
let articleList = this.articleTypeOptions
for (let article of articleList) {
console.log(article.title)
if (navId === article.id && article.isThumbnail == 1){
if (navId === article.id && article.isThumbnail == 1) {
this.imgurlShow = true
return
}
}
},
auditShow(navId,type){
auditShow(navId, type) {
let typeList = this.articleTypeOptions
for (let item of typeList) {
if (navId === item.id && item.isAudit == 1){
if (type == 1){
if (navId === item.id && item.isAudit == 1) {
if (type == 1) {
this.isAuditShow.sist = true
}else {
} else {
this.isAuditShow.lab = true
}
return
@@ -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

@@ -10,25 +10,25 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="操作人员" prop="createBy">-->
<!-- <el-input-->
<!-- v-model="queryParams.createBy"-->
<!-- placeholder="请输入操作人员"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="类型" prop="noticeType">-->
<!-- <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">-->
<!-- <el-option-->
<!-- v-for="dict in typeOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictValue"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="操作人员" prop="createBy">-->
<!-- <el-input-->
<!-- v-model="queryParams.createBy"-->
<!-- placeholder="请输入操作人员"-->
<!-- clearable-->
<!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="类型" prop="noticeType">-->
<!-- <el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable size="small">-->
<!-- <el-option-->
<!-- v-for="dict in typeOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictValue"-->
<!-- />-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -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,35 +68,36 @@
: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>
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="noticeId" width="100"/>
<el-table-column
label="公告标题"
align="center"
prop="noticeTitle"
:show-overflow-tooltip="true"
/>
<!-- <el-table-column-->
<!-- label="公告类型"-->
<!-- align="center"-->
<!-- prop="noticeType"-->
<!-- :formatter="typeFormat"-->
<!-- width="100"-->
<!-- />-->
<!-- <el-table-column-->
<!-- label="状态"-->
<!-- align="center"-->
<!-- prop="status"-->
<!-- :formatter="statusFormat"-->
<!-- width="100"-->
<!-- />-->
<!-- <el-table-column label="创建者" align="center" prop="createBy" width="100" />-->
<!-- <el-table-column-->
<!-- label="公告类型"-->
<!-- align="center"-->
<!-- prop="noticeType"-->
<!-- :formatter="typeFormat"-->
<!-- width="100"-->
<!-- />-->
<!-- <el-table-column-->
<!-- label="状态"-->
<!-- align="center"-->
<!-- prop="status"-->
<!-- :formatter="statusFormat"-->
<!-- width="100"-->
<!-- />-->
<!-- <el-table-column label="创建者" align="center" prop="createBy" width="100" />-->
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
@@ -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>
@@ -134,38 +139,63 @@
<el-row>
<el-col :span="12">
<el-form-item label="公告标题" prop="noticeTitle">
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题"/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="公告类型" prop="noticeType">-->
<!-- <el-select v-model="form.noticeType" placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="dict in typeOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictValue"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="状态">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio-->
<!-- v-for="dict in statusOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictValue"-->
<!-- >{{dict.dictLabel}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="12">-->
<!-- <el-form-item label="公告类型" prop="noticeType">-->
<!-- <el-select v-model="form.noticeType" placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="dict in typeOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictLabel"-->
<!-- :value="dict.dictValue"-->
<!-- ></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="24">-->
<!-- <el-form-item label="状态">-->
<!-- <el-radio-group v-model="form.status">-->
<!-- <el-radio-->
<!-- v-for="dict in statusOptions"-->
<!-- :key="dict.dictValue"-->
<!-- :label="dict.dictValue"-->
<!-- >{{dict.dictLabel}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </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,134 +255,185 @@ 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) {
this.ids = selection.map(item => item.noticeId)
this.single = selection.length!=1
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
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{
/deep/ .w-e-text {
min-height: 242px;
}
</style>

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) {