clay commit : 第一阶段完成
This commit is contained in:
@@ -89,6 +89,7 @@ export default {
|
|||||||
init () {
|
init () {
|
||||||
const _this = this
|
const _this = this
|
||||||
this.editor = new Editor(this.$refs.editor)
|
this.editor = new Editor(this.$refs.editor)
|
||||||
|
this.editor.config.uploadImgAccept = ['doc', 'docx', 'png', 'gif', 'bmp', 'webp']
|
||||||
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.pasteFilterStyle = false
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import { getToken } from "@/utils/auth";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
|
||||||
// 值
|
// 值
|
||||||
value: [String, Object, Array],
|
value: [String, Object, Array],
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
@@ -141,7 +140,7 @@ export default {
|
|||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
this.$message.success("提交成功!");
|
this.$message.success("提交成功!");
|
||||||
this.$emit("input", res.url);
|
this.$emit("input", res.url);
|
||||||
this.$emit("change",res.fileName);
|
this.$emit("change",res);
|
||||||
},
|
},
|
||||||
// 删除文件
|
// 删除文件
|
||||||
handleDelete(index) {
|
handleDelete(index) {
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ const user = {
|
|||||||
const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : user.avatar;
|
const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : user.avatar;
|
||||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||||
commit('SET_ROLES', res.roles)
|
commit('SET_ROLES', res.roles)
|
||||||
|
sessionStorage.setItem("roles",JSON.stringify(user.roles))
|
||||||
commit('SET_PERMISSIONS', res.permissions)
|
commit('SET_PERMISSIONS', res.permissions)
|
||||||
} else {
|
} else {
|
||||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||||
|
|||||||
129
ebts-ui/src/views/sist/article/components/ArticleFile.vue
Normal file
129
ebts-ui/src/views/sist/article/components/ArticleFile.vue
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
import { addFile, delFile } from '../../../../api/sist/file'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ArticleFile',
|
||||||
|
props: {
|
||||||
|
|
||||||
|
value: {
|
||||||
|
type: Object,
|
||||||
|
default: function () {
|
||||||
|
return {
|
||||||
|
fileList: [],
|
||||||
|
fileMapper: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fileList:{
|
||||||
|
type:Array,
|
||||||
|
default: function () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fileMapper:{
|
||||||
|
type:Array,
|
||||||
|
default: function () {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Bearer ' + getToken()
|
||||||
|
},
|
||||||
|
// fileList: value.fileList,
|
||||||
|
// fileList: [{
|
||||||
|
// name: 'food.jpeg',
|
||||||
|
// url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
|
||||||
|
// }, {
|
||||||
|
// name: 'food2.jpeg',
|
||||||
|
// url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
|
||||||
|
// }],
|
||||||
|
// fileMapper: value.fileMapper
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
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('提交成功!')
|
||||||
|
})
|
||||||
|
this.$emit('input', {
|
||||||
|
fileList: this.fileList,
|
||||||
|
fileMapper: this.fileMapper
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 上传成功回调
|
||||||
|
handleUploadSuccess(res, file) {
|
||||||
|
console.log(file)
|
||||||
|
console.log(res)
|
||||||
|
let data = {
|
||||||
|
isPublic: '1',
|
||||||
|
fileType: '',
|
||||||
|
fileAddr: res.fileName
|
||||||
|
}
|
||||||
|
addFile(data).then(res => {
|
||||||
|
console.log(res)
|
||||||
|
let data = res.data
|
||||||
|
let mapperItem = {
|
||||||
|
id: data.fileId,
|
||||||
|
uid: file.uid
|
||||||
|
}
|
||||||
|
this.fileMapper.push(mapperItem)
|
||||||
|
})
|
||||||
|
this.$message.success('提交成功!')
|
||||||
|
|
||||||
|
this.$emit('input', {
|
||||||
|
fileList: this.fileList,
|
||||||
|
fileMapper: this.fileMapper
|
||||||
|
})
|
||||||
|
this.$emit('change', {
|
||||||
|
fileList: this.fileList,
|
||||||
|
fileMapper: this.fileMapper
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -105,6 +105,26 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<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-row>
|
||||||
<el-col :offset="1" :span="22">
|
<el-col :offset="1" :span="22">
|
||||||
<Editor v-model="formData.content" :height="800"/>
|
<Editor v-model="formData.content" :height="800"/>
|
||||||
@@ -122,20 +142,31 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
// import ArticleFile from './ArticleFile'
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
|
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
import UploadFile from '@/views/utils/uploadFile.vue';
|
import UploadFile from '@/views/utils/uploadFile.vue';
|
||||||
import { getArticleNav } from '../../../../api/sist/article'
|
import { getArticleNav } from '../../../../api/sist/article'
|
||||||
|
import { getToken } from '../../../../utils/auth'
|
||||||
|
import { addFile, delFile } from '../../../../api/sist/file'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Editor,
|
Editor,
|
||||||
UploadFile
|
UploadFile,
|
||||||
|
// ArticleFile
|
||||||
},
|
},
|
||||||
props: [],
|
props: [],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
isAdmin:false,
|
||||||
|
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
|
||||||
|
headers: {
|
||||||
|
Authorization: 'Bearer ' + getToken()
|
||||||
|
},
|
||||||
|
fileList:[],
|
||||||
|
fileMapper:[],
|
||||||
submit: 1,
|
submit: 1,
|
||||||
imgurlShow:false,
|
imgurlShow:false,
|
||||||
formData: {
|
formData: {
|
||||||
@@ -219,21 +250,22 @@ export default {
|
|||||||
this.formData = response.data
|
this.formData = response.data
|
||||||
if (this.formData.siteType === '2') {
|
if (this.formData.siteType === '2') {
|
||||||
this.approveShow.sist = false
|
this.approveShow.sist = false
|
||||||
this.params.labArticleType = parseInt(this.formData.type)
|
if (null != this.formData.navId){
|
||||||
this.getLabApprove(this.params.labArticleType)
|
this.params.labArticleType = parseInt(this.formData.navId)
|
||||||
|
this.getLabApprove(this.params.labArticleType)
|
||||||
|
}
|
||||||
} else if (this.formData.siteType === '1') {
|
} else if (this.formData.siteType === '1') {
|
||||||
this.approveShow.lab = false
|
this.approveShow.lab = false
|
||||||
this.params.sistArticleType = parseInt(this.formData.type)
|
if (null != this.formData.navId){
|
||||||
this.getSistApprove(this.params.sistArticleType)
|
this.params.sistArticleType = parseInt(this.formData.navId)
|
||||||
|
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.getDicts("article_type").then(response => {
|
|
||||||
// this.articleTypeOptions = response.data;
|
|
||||||
// });
|
|
||||||
this.getDicts("is_top").then(response => {
|
this.getDicts("is_top").then(response => {
|
||||||
this.isTopOptions = response.data;
|
this.isTopOptions = response.data;
|
||||||
});
|
});
|
||||||
@@ -256,28 +288,54 @@ export default {
|
|||||||
this.labArticleTypeOption.push(item)
|
this.labArticleTypeOption.push(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(res)
|
|
||||||
})
|
})
|
||||||
// getArticleType().then(res => {
|
|
||||||
// let dictCodes = res.data
|
|
||||||
// let articleList = this.articleTypeOptions
|
|
||||||
// console.log("dictCodes",dictCodes,"articleList",articleList)
|
|
||||||
// for (let i = 0; i < articleList.length; i++) {
|
|
||||||
// for (let j = 0; j < dictCodes.length; j++) {
|
|
||||||
// if (articleList[i].dictCode == dictCodes[j]) {
|
|
||||||
// if (articleList[i].attribute2 == 1) {
|
|
||||||
// this.sistArticleTypeOption.push(articleList[i])
|
|
||||||
// } else if (articleList[i].attribute2 == 2) {
|
|
||||||
// this.labArticleTypeOption.push(articleList[i])
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
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 fileStr = '<p><a target="_blank" href="'+mapperItem.url+'">'+mapperItem.fileName+'</a><br/></p>'
|
||||||
|
this.formData.content = this.formData.content + fileStr
|
||||||
|
this.fileMapper.push(mapperItem)
|
||||||
|
})
|
||||||
|
this.$message.success('提交成功!')
|
||||||
|
},
|
||||||
|
|
||||||
getSistApprove(navId) {
|
getSistApprove(navId) {
|
||||||
this.judgeThumbnail(navId)
|
this.judgeThumbnail(navId)
|
||||||
getArticleApprove(navId).then(res => {
|
getArticleApprove(navId).then(res => {
|
||||||
@@ -323,13 +381,6 @@ export default {
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if (that_.imgurlShow&&(that_.formData.imgurl == ''||that_.formData.imgurl == null)){
|
|
||||||
// Message({
|
|
||||||
// message: "请选择缩略图",
|
|
||||||
// type: "error",
|
|
||||||
// })
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
that_.formData.params = that_.params
|
that_.formData.params = that_.params
|
||||||
if (that_.submit == 0) {
|
if (that_.submit == 0) {
|
||||||
@@ -360,16 +411,16 @@ export default {
|
|||||||
this.$router.push({path: "/SIST/article/", query: {t: Date.now()}})
|
this.$router.push({path: "/SIST/article/", query: {t: Date.now()}})
|
||||||
},
|
},
|
||||||
saveDrafts() {
|
saveDrafts() {
|
||||||
let that_ = this
|
let that = this
|
||||||
this.$refs['elForm'].validate(valid => {
|
this.$refs['elForm'].validate(valid => {
|
||||||
drafts(this.formData).then(res => {
|
drafts(that.formData).then(res => {
|
||||||
if (this.formData.id == null || this.formData.id == "") {
|
if (that.formData.id == null || this.formData.id == "") {
|
||||||
this.formData.id = res.data
|
that.formData.id = res.data
|
||||||
}
|
}
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
that_.msgSuccess('保存成功');
|
that.msgSuccess('保存成功');
|
||||||
} else {
|
} else {
|
||||||
that_.Message({
|
that.Message({
|
||||||
message: res.code,
|
message: res.code,
|
||||||
type: "error"
|
type: "error"
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -146,11 +146,11 @@
|
|||||||
<!-- disable-transitions>完成-->
|
<!-- disable-transitions>完成-->
|
||||||
<!-- </el-tag>-->
|
<!-- </el-tag>-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
<!-- <el-table-column label="修改时间 " align="center" prop="createTime" width="180">-->
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<!-- <template slot-scope="scope">-->
|
<template slot-scope="scope">
|
||||||
<!-- <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>-->
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
<!-- </template>-->
|
</template>
|
||||||
<!-- </el-table-column>-->
|
</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>
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
@click="handleApprova(scope.row)"
|
@click="handleApprova(scope.row)"
|
||||||
>审批
|
>审批
|
||||||
</el-button>
|
</el-button>
|
||||||
<span v-show="scope.row.approvalUserId===userId && scope.row.status === '3'">
|
<span v-show="(scope.row.approvalUserId===userId || isAdmin) && scope.row.status === '3'">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -363,6 +363,19 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
|
|
||||||
|
let roles = JSON.parse(sessionStorage.getItem("roles"))
|
||||||
|
console.log(roles,"roles")
|
||||||
|
for (const role of roles) {
|
||||||
|
console.log(role)
|
||||||
|
if (role.roleName == 'admin'){
|
||||||
|
this.isAdmin = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getArticleNav().then(res=>{
|
getArticleNav().then(res=>{
|
||||||
let data = res.data
|
let data = res.data
|
||||||
this.articleTypeOptions = data
|
this.articleTypeOptions = data
|
||||||
@@ -385,6 +398,11 @@ export default {
|
|||||||
this.getDicts('article_status').then(response => {
|
this.getDicts('article_status').then(response => {
|
||||||
this.statusOptions = response.data
|
this.statusOptions = response.data
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// activated() {
|
// activated() {
|
||||||
// this.getList()
|
// this.getList()
|
||||||
|
|||||||
@@ -94,7 +94,6 @@
|
|||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleFileUpdate"
|
@click="handleFileUpdate"
|
||||||
v-hasPermi="['sist:file:edit']"
|
|
||||||
>文件上传
|
>文件上传
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -118,7 +117,6 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['sist:file:remove']"
|
|
||||||
>删除
|
>删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -224,10 +222,10 @@
|
|||||||
<FileUpload v-model="addFile.url" @change="changeAddress"/>
|
<FileUpload v-model="addFile.url" @change="changeAddress"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<!-- <div slot="footer" class="dialog-footer">-->
|
||||||
<el-button type="primary" @click="submitAddFile">确 定</el-button>
|
<!-- <el-button type="primary" @click="submitAddFile">确 定</el-button>-->
|
||||||
<el-button @click="addCancel">取 消</el-button>
|
<!-- <el-button @click="addCancel">取 消</el-button>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
@@ -464,8 +462,10 @@ export default {
|
|||||||
* 改变地址
|
* 改变地址
|
||||||
*/
|
*/
|
||||||
changeAddress(addr) {
|
changeAddress(addr) {
|
||||||
console.log(addr)
|
console.log(addr,"res")
|
||||||
this.form.fileAddr = addr
|
this.form.fileAddr = addr.fileAddr
|
||||||
|
this.form.fileName = addr.fileName
|
||||||
|
this.submitAddFile()
|
||||||
},
|
},
|
||||||
/** 文件上传 */
|
/** 文件上传 */
|
||||||
handleFileUpdate() {
|
handleFileUpdate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user