|
@@ -17,7 +17,7 @@ |
|
|
<p>里程碑</p> |
|
|
<p>里程碑</p> |
|
|
<div class="switch_btn"> |
|
|
<div class="switch_btn"> |
|
|
<el-switch |
|
|
<el-switch |
|
|
v-model="file.milestone" |
|
|
|
|
|
|
|
|
v-model="commitInfo.milestone" |
|
|
@change="setMileStoneClick" |
|
|
@change="setMileStoneClick" |
|
|
active-color="#7850FF" |
|
|
active-color="#7850FF" |
|
|
inactive-color="#fff"> |
|
|
inactive-color="#fff"> |
|
@@ -29,14 +29,14 @@ |
|
|
<div class="file_info"> |
|
|
<div class="file_info"> |
|
|
<ul> |
|
|
<ul> |
|
|
<li><span>提交人:</span><span class="left" style="color:#2869E6">{{showAccountName}}</span></li> |
|
|
<li><span>提交人:</span><span class="left" style="color:#2869E6">{{showAccountName}}</span></li> |
|
|
<li><span>基于版本:</span><span class="left">{{file.creator}} 提交的版本{{file.version}}</span></li> |
|
|
|
|
|
|
|
|
<li><span>基于版本:</span><span class="left">{{commitInfo.creator}} 提交的版本{{commitInfo.version}}</span></li> |
|
|
<li><span>协同于:</span><span class="left">{{showTime}}</span></li> |
|
|
<li><span>协同于:</span><span class="left">{{showTime}}</span></li> |
|
|
</ul> |
|
|
</ul> |
|
|
<div class="btn_box"> |
|
|
<div class="btn_box"> |
|
|
<div class="btn" v-if="!nowVersion"> |
|
|
|
|
|
|
|
|
<div class="btn" v-if="!nowVersion" @click.stop="showHistoryFile"> |
|
|
查看版本 |
|
|
查看版本 |
|
|
</div> |
|
|
</div> |
|
|
<div class="edit_btn btn" v-if="nowVersion"> |
|
|
|
|
|
|
|
|
<div class="edit_btn btn" v-if="nowVersion" @click.stop="editCurrentFile"> |
|
|
继续编辑 |
|
|
继续编辑 |
|
|
</div> |
|
|
</div> |
|
|
<div class="set_btn btn" v-if="!nowVersion" @click.stop="setShare"> |
|
|
<div class="set_btn btn" v-if="!nowVersion" @click.stop="setShare"> |
|
@@ -59,7 +59,7 @@ |
|
|
<div :class="{myremarks_content:!isShowAll}" |
|
|
<div :class="{myremarks_content:!isShowAll}" |
|
|
ref="remarksText" |
|
|
ref="remarksText" |
|
|
> |
|
|
> |
|
|
{{file.note ? file.note : "无备注" }} |
|
|
|
|
|
|
|
|
{{commitInfo.note ? commitInfo.note : "无备注" }} |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@@ -82,12 +82,12 @@ |
|
|
<!-- 版本信息简略 --> |
|
|
<!-- 版本信息简略 --> |
|
|
<div class="version_item_brief" v-if="!selectedVersion && !nowVersion" @click.stop="clickVersion"> |
|
|
<div class="version_item_brief" v-if="!selectedVersion && !nowVersion" @click.stop="clickVersion"> |
|
|
<div class="header"> |
|
|
<div class="header"> |
|
|
<p>版本{{file.version}}</p> |
|
|
|
|
|
|
|
|
<p>版本{{commitInfo.version}}</p> |
|
|
<p class="header_time">{{showTime}}</p> |
|
|
<p class="header_time">{{showTime}}</p> |
|
|
</div> |
|
|
</div> |
|
|
<div class="remarks_brief"> |
|
|
<div class="remarks_brief"> |
|
|
<div class="icon_box"><span class="iconfont icon-lichengbei-qizhi"></span></div> |
|
|
<div class="icon_box"><span class="iconfont icon-lichengbei-qizhi"></span></div> |
|
|
<div class="remarks_brief_content" :class="{noremarks:true}">{{file.note ? file.note: "无备注"}}</div> |
|
|
|
|
|
|
|
|
<div class="remarks_brief_content" :class="{noremarks:true}">{{commitInfo.note ? commitInfo.note: "无备注"}}</div> |
|
|
<div class="remarks_icon"> |
|
|
<div class="remarks_icon"> |
|
|
<i class="iconfont icon-beizhu"></i> |
|
|
<i class="iconfont icon-beizhu"></i> |
|
|
</div> |
|
|
</div> |
|
@@ -103,19 +103,26 @@ import moment from 'dayjs'; |
|
|
import 'dayjs/locale/zh-cn'; |
|
|
import 'dayjs/locale/zh-cn'; |
|
|
moment.locale('zh-cn'); |
|
|
moment.locale('zh-cn'); |
|
|
import {setShareFile} from '../service' |
|
|
import {setShareFile} from '../service' |
|
|
|
|
|
import system from '@/services/system'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
props:{ |
|
|
props:{ |
|
|
nowVersion:Boolean, |
|
|
|
|
|
// selectedVersion:Boolean, |
|
|
|
|
|
// flagcolor: { |
|
|
|
|
|
// type:String, |
|
|
|
|
|
// default:'#7850FF' |
|
|
|
|
|
// } |
|
|
|
|
|
file :{ |
|
|
|
|
|
type:Object, |
|
|
|
|
|
default: ()=>({}) |
|
|
|
|
|
}, |
|
|
|
|
|
fileId : String |
|
|
|
|
|
|
|
|
localWorkspacePrefix:String, |
|
|
|
|
|
nowVersion:Boolean, |
|
|
|
|
|
// selectedVersion:Boolean, |
|
|
|
|
|
// flagcolor: { |
|
|
|
|
|
// type:String, |
|
|
|
|
|
// default:'#7850FF' |
|
|
|
|
|
// } |
|
|
|
|
|
commitInfo :{ |
|
|
|
|
|
type:Object, |
|
|
|
|
|
default: ()=>({}) |
|
|
|
|
|
}, |
|
|
|
|
|
file :{ |
|
|
|
|
|
type:Object, |
|
|
|
|
|
default: ()=>({}) |
|
|
|
|
|
}, |
|
|
|
|
|
fileId : String |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
this.remarkEl = this.$refs.remarksText; |
|
|
this.remarkEl = this.$refs.remarksText; |
|
@@ -144,6 +151,41 @@ export default { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods:{ |
|
|
methods:{ |
|
|
|
|
|
showHistoryFile() { |
|
|
|
|
|
// 历史版本查看 |
|
|
|
|
|
const { file, commitInfo } = this; |
|
|
|
|
|
const { archName: fileName, extension, relativePath } = file; |
|
|
|
|
|
const { currentHash: ipfsCid, version } = commitInfo; |
|
|
|
|
|
const extensionedFileName = `${fileName}-版本${version}${extension ? `.${extension}`:''}`; |
|
|
|
|
|
const dirName = `历史版本查看\\${new Date().getTime()}${relativePath ? '\\relativePath' : ''}`.replace(/\//g, '\\'); |
|
|
|
|
|
|
|
|
|
|
|
const errorHandler = () => { |
|
|
|
|
|
// this.removeFileLoadingState(file.id); |
|
|
|
|
|
} |
|
|
|
|
|
const fullFilePath = `${this.localWorkspacePrefix}\\${dirName}\\${extensionedFileName}`; |
|
|
|
|
|
system.downloadFile(ipfsCid, sessionStorage.projName, extensionedFileName, dirName, (resMessage, socketIns) => { |
|
|
|
|
|
console.log('receive download file message:', resMessage, socketIns); |
|
|
|
|
|
// {"size":"11","currentSize":"11","unit":"B","process":100,"hash":""} |
|
|
|
|
|
try { |
|
|
|
|
|
const { process, hash } = JSON.parse(resMessage.data); |
|
|
|
|
|
// this.updateFileLoadState(file, DOWNLOADING, process); |
|
|
|
|
|
if(process !== 100) return; |
|
|
|
|
|
system.openFile(fullFilePath); |
|
|
|
|
|
// this.removeFileLoadingState(file.id); |
|
|
|
|
|
// this.$notify({ |
|
|
|
|
|
// type:["success","download"], |
|
|
|
|
|
// title:"文件已下载", |
|
|
|
|
|
// message:`${fileName}` |
|
|
|
|
|
// }) |
|
|
|
|
|
socketIns.close(); |
|
|
|
|
|
// this.$forceUpdate(); |
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
console.error('socket-download-file parse data have error:', e); |
|
|
|
|
|
errorHandler(); |
|
|
|
|
|
socketIns.close(); |
|
|
|
|
|
} |
|
|
|
|
|
}, errorHandler); |
|
|
|
|
|
}, |
|
|
onMakeCopy(){ |
|
|
onMakeCopy(){ |
|
|
this.$emit('makeCopy', this.file); |
|
|
this.$emit('makeCopy', this.file); |
|
|
}, |
|
|
}, |
|
@@ -187,8 +229,11 @@ export default { |
|
|
closeSetColor(){ |
|
|
closeSetColor(){ |
|
|
this.toolboxShow = false; |
|
|
this.toolboxShow = false; |
|
|
}, |
|
|
}, |
|
|
|
|
|
editCurrentFile() { |
|
|
|
|
|
this.$emit('openFile'); |
|
|
|
|
|
}, |
|
|
async setShare() { |
|
|
async setShare() { |
|
|
const res = await setShareFile (this.fileId,this.file.currentHash,sessionStorage.userId); |
|
|
|
|
|
|
|
|
const res = await setShareFile (this.fileId,this.commitInfo.currentHash,sessionStorage.userId); |
|
|
if(res.Code == 0) { |
|
|
if(res.Code == 0) { |
|
|
this.$notify({ |
|
|
this.$notify({ |
|
|
type:'success', |
|
|
type:'success', |
|
@@ -203,16 +248,16 @@ export default { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
setMileStoneClick(val) { |
|
|
setMileStoneClick(val) { |
|
|
this.$bus.$emit('setMileStoneClick', val, this.file); |
|
|
|
|
|
|
|
|
this.$bus.$emit('setMileStoneClick', val, this.commitInfo); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
computed: { |
|
|
computed: { |
|
|
showAccountName() { |
|
|
showAccountName() { |
|
|
return this.file.creator && sessionStorage.accountName == this.file.creator ? '我': this.file.creator; |
|
|
|
|
|
|
|
|
return this.commitInfo.creator && sessionStorage.accountName == this.commitInfo.creator ? '我': this.commitInfo.creator; |
|
|
}, |
|
|
}, |
|
|
showTime() { |
|
|
showTime() { |
|
|
return this.file.createTime && moment(this.file.createTime*1000).format('YYYY年MM月DD日 A HH:mm'); |
|
|
|
|
|
|
|
|
return this.commitInfo.createTime && moment(this.commitInfo.createTime*1000).format('YYYY年MM月DD日 A HH:mm'); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|