no message
This commit is contained in:
parent
19a154e0b9
commit
abd65f8c07
@ -1,8 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="file-content">
|
<div class="file-content">
|
||||||
<div class="edit-header">
|
<div class="edit-header">
|
||||||
<div class="header-title">{{file.name}}</div>
|
<div class="header-title">
|
||||||
<div v-if="file.type=='document'" class="header-hint">
|
<EPopover v-if="!equalContent" v-model="unsaveTip" class="file-unsave-tip">
|
||||||
|
<div class="task-detail-delete-file-popover">
|
||||||
|
<p>{{$L('未保存当前修改内容?')}}</p>
|
||||||
|
<div class="buttons">
|
||||||
|
<Button size="small" type="text" @click="unsaveGive">{{$L('放弃')}}</Button>
|
||||||
|
<Button size="small" type="primary" @click="unsaveSave">{{$L('保存')}}</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span slot="reference">[{{$L('未保存')}}*]</span>
|
||||||
|
</EPopover>
|
||||||
|
{{file.name}}
|
||||||
|
</div>
|
||||||
|
<div v-if="file.type=='document' && contentDetail" class="header-hint">
|
||||||
<ButtonGroup size="small" shape="circle">
|
<ButtonGroup size="small" shape="circle">
|
||||||
<Button :type="`${contentDetail.type!='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'text')">{{$L('文本编辑器')}}</Button>
|
<Button :type="`${contentDetail.type!='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'text')">{{$L('文本编辑器')}}</Button>
|
||||||
<Button :type="`${contentDetail.type=='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'md')">{{$L('MD编辑器')}}</Button>
|
<Button :type="`${contentDetail.type=='md'?'primary':'default'}`" @click="$set(contentDetail, 'type', 'md')">{{$L('MD编辑器')}}</Button>
|
||||||
@ -29,7 +41,7 @@
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
<Button v-if="!file.only_view" :disabled="equalContent" :loading="loadIng > 0" class="header-button" size="small" type="primary" @click="handleClick('save')">{{$L('保存')}}</Button>
|
<Button v-if="!file.only_view" :disabled="equalContent" :loading="loadIng > 0" class="header-button" size="small" type="primary" @click="handleClick('save')">{{$L('保存')}}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="contentId > 0" class="content-body">
|
<div v-if="contentDetail" class="content-body">
|
||||||
<template v-if="file.type=='document'">
|
<template v-if="file.type=='document'">
|
||||||
<MDEditor v-if="contentDetail.type=='md'" v-model="contentDetail.content" height="100%"/>
|
<MDEditor v-if="contentDetail.type=='md'" v-model="contentDetail.content" height="100%"/>
|
||||||
<TEditor v-else v-model="contentDetail.content" height="100%" @editorSave="handleClick('saveBefore')"/>
|
<TEditor v-else v-model="contentDetail.content" height="100%" @editorSave="handleClick('saveBefore')"/>
|
||||||
@ -44,6 +56,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Minder from '../../../components/minder'
|
import Minder from '../../../components/minder'
|
||||||
|
import {mapState} from "vuex";
|
||||||
Vue.use(Minder)
|
Vue.use(Minder)
|
||||||
|
|
||||||
const MDEditor = () => import('../../../components/MDEditor/index');
|
const MDEditor = () => import('../../../components/MDEditor/index');
|
||||||
@ -68,12 +81,18 @@ export default {
|
|||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
|
|
||||||
fileId: 0,
|
fileId: 0,
|
||||||
contentId: 0,
|
|
||||||
contentDetail: {},
|
unsaveTip: false,
|
||||||
|
|
||||||
|
contentDetail: null,
|
||||||
contentBak: {},
|
contentBak: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroyed() {
|
||||||
|
this.fileContent[this.fileId] = this.contentDetail;
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
file: {
|
file: {
|
||||||
handler(info) {
|
handler(info) {
|
||||||
@ -88,6 +107,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapState(['fileContent']),
|
||||||
|
|
||||||
equalContent() {
|
equalContent() {
|
||||||
return this.contentBak == $A.jsonStringify(this.contentDetail);
|
return this.contentBak == $A.jsonStringify(this.contentDetail);
|
||||||
},
|
},
|
||||||
@ -99,6 +120,10 @@ export default {
|
|||||||
this.contentDetail = {};
|
this.contentDetail = {};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (typeof this.fileContent[this.fileId] !== "undefined") {
|
||||||
|
this.contentDetail = this.fileContent[this.fileId];
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'file/content',
|
url: 'file/content',
|
||||||
@ -107,7 +132,6 @@ export default {
|
|||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
this.contentId = data.id;
|
|
||||||
this.contentDetail = data.content;
|
this.contentDetail = data.content;
|
||||||
this.updateBak();
|
this.updateBak();
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
@ -175,6 +199,17 @@ export default {
|
|||||||
this.$refs.mySheet.exportExcel(this.file.title, act);
|
this.$refs.mySheet.exportExcel(this.file.title, act);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
unsaveGive() {
|
||||||
|
delete this.fileContent[this.fileId];
|
||||||
|
this.getContent();
|
||||||
|
this.unsaveTip = false;
|
||||||
|
},
|
||||||
|
|
||||||
|
unsaveSave() {
|
||||||
|
this.handleClick('save');
|
||||||
|
this.unsaveTip = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,8 +290,8 @@
|
|||||||
<div class="task-detail-delete-file-popover">
|
<div class="task-detail-delete-file-popover">
|
||||||
<p>{{$L('你确定要删除这个文件吗?')}}</p>
|
<p>{{$L('你确定要删除这个文件吗?')}}</p>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<Button size="small" type="text" @click="file._deling=false">取消</Button>
|
<Button size="small" type="text" @click="file._deling=false">{{$L('取消')}}</Button>
|
||||||
<Button size="small" type="primary" @click="deleteFile(file)">确定</Button>
|
<Button size="small" type="primary" @click="deleteFile(file)">{{$L('确定')}}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<i slot="reference" :class="['iconfont', file._deling ? 'deling' : '']"></i>
|
<i slot="reference" :class="['iconfont', file._deling ? 'deling' : '']"></i>
|
||||||
|
1
resources/assets/js/store/state.js
vendored
1
resources/assets/js/store/state.js
vendored
@ -271,6 +271,7 @@ state.dialogOpenId = 0;
|
|||||||
|
|
||||||
// 文件
|
// 文件
|
||||||
state.files = [];
|
state.files = [];
|
||||||
|
state.fileContent = {};
|
||||||
|
|
||||||
// 项目任务
|
// 项目任务
|
||||||
state.projectId = 0;
|
state.projectId = 0;
|
||||||
|
@ -25,10 +25,21 @@
|
|||||||
color: #333333;
|
color: #333333;
|
||||||
padding-left: 24px;
|
padding-left: 24px;
|
||||||
padding-right: 24px;
|
padding-right: 24px;
|
||||||
|
line-height: 24px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow:ellipsis;
|
text-overflow:ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
.file-unsave-tip {
|
||||||
|
color: #333333;
|
||||||
|
padding-right: 6px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.3s;
|
||||||
|
&:hover {
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.header-hint {
|
.header-hint {
|
||||||
padding-right: 22px;
|
padding-right: 22px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user