|
|
@@ -65,6 +65,8 @@ |
|
|
|
> |
|
|
|
<AddFileButton |
|
|
|
v-if="isClient" |
|
|
|
@fileTempClick="fileTempClick" |
|
|
|
:listTempFiles="listTempFiles" |
|
|
|
:selectSystemFiles="selectSystemFiles" |
|
|
|
:selectSystemFolders="selectSystemFolders" |
|
|
|
/> |
|
|
@@ -325,6 +327,62 @@ |
|
|
|
<el-button @click="createSubFolder()" type="primary">确 定</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 创建样本文件分组 --> |
|
|
|
<el-dialog v-if="currentSelectTempFile" class="temp-file-dialog" |
|
|
|
:title="showNewTemplateFileDialogTitle" |
|
|
|
@submit.native.prevent |
|
|
|
:visible.sync="isShowNewTemplateFileDialog" |
|
|
|
width="460px" |
|
|
|
:show-close="false" |
|
|
|
:close-on-click-modal="false" |
|
|
|
> |
|
|
|
<el-form> |
|
|
|
<div class="appImgiconbox" |
|
|
|
v-if="oneOf(currentSelectTempFile.extension, ['doc','docx','dwg','dxf','gif','jpeg','jpg','max','nwc','pdf','png','ppt','pptx','rar','rvt','skp','txt','xls','xlsx','xmind','zip'])"> |
|
|
|
<img |
|
|
|
:src=" |
|
|
|
'/static/img/files/file_sample_' + currentSelectTempFile.extension + '.svg' |
|
|
|
" |
|
|
|
alt |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div v-else class="img-container"> |
|
|
|
<!-- 非图片文件图标 --> |
|
|
|
<div |
|
|
|
v-if="notPicIcon()" |
|
|
|
class="defultImage-small" |
|
|
|
:class="`${currentSelectTempFile.extension}-mid`" |
|
|
|
/> |
|
|
|
<!-- 图片文件图标 --> |
|
|
|
<div |
|
|
|
v-else-if="picIcon()" |
|
|
|
class="defultImage-small img_bg-mid" |
|
|
|
> |
|
|
|
<div class="file_Im gbox-mid"> |
|
|
|
<img v-lazy="currentSelectTempFile.alias" alt class="file_Img" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 视频文件图标 --> |
|
|
|
<div |
|
|
|
v-else |
|
|
|
class="video-small" |
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="guide-template-file-name">{{projectName + '_' + currentNodeFolder.folderName + '_' + currentSelectTempFile.fileName + '.' + currentSelectTempFile.extension}}</div> |
|
|
|
<el-form-item> |
|
|
|
<el-input |
|
|
|
v-model="currentSelectTempFile.fileName" |
|
|
|
@keyup.enter.native="createTemplateFile" |
|
|
|
></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="isShowNewTemplateFileDialog = false">取 消</el-button> |
|
|
|
<el-button @click="createTemplateFile()" type="primary">完成创建</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@@ -345,11 +403,12 @@ import AddFileButton from './components/add-file-button'; |
|
|
|
// import draggable from "vuedraggable"; |
|
|
|
import vuetify from "vuetify"; |
|
|
|
import system from '@/services/system'; |
|
|
|
import { queryAllTemplateNodeModelFile } from '@/services/template.js'; |
|
|
|
import * as services from './service'; |
|
|
|
import { firstCharToLowerCase, firstCharToUpperCase, notify } from '@/utils/tool'; |
|
|
|
import FileItem from './components/file-item'; |
|
|
|
import FolderItem from './components/folder-item'; |
|
|
|
import { FileWorkStatus, getFileStoreKey, injectionFileLocalStatus, LoadingEnum, VirtualFolder, analyzeRelativePath } from './helper'; |
|
|
|
import { FileWorkStatus, getFileStoreKey, injectionFileLocalStatus, LoadingEnum, VirtualFolder, analyzeRelativePath, imgExtensionList, RecExtensionList, VideoExtensionList, office, filePreviewList } from './helper'; |
|
|
|
import { propertyOf, uniqBy, throttle, flatten } from 'lodash'; |
|
|
|
|
|
|
|
const $ = window.jQuery; |
|
|
@@ -439,6 +498,10 @@ export default { |
|
|
|
uploadFileList: [], // 上传文件的队列 |
|
|
|
workFileList: [], // 工作文件队列 |
|
|
|
|
|
|
|
listTempFiles: [],//样板文件列表 |
|
|
|
currentSelectTempFile: null,//选择创建的样本文件 |
|
|
|
isShowNewTemplateFileDialog: false,//显示新建样本文件弹框 |
|
|
|
|
|
|
|
workSubFolderList: [], // 工作文件夹队列 |
|
|
|
coopSubFolderList: [],//协作文件夹队列 |
|
|
|
tempWorkSubFolderList: [], // 临时的工作文件夹队列 |
|
|
@@ -508,6 +571,10 @@ export default { |
|
|
|
sessionStorage.removeItem('nowFolderIndex'); |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 创建样板文件的标题 创建XXX文件 |
|
|
|
showNewTemplateFileDialogTitle() { |
|
|
|
return `创建${this.currentSelectTempFile ? this.currentSelectTempFile.extension : ''}文件`; |
|
|
|
}, |
|
|
|
// 当前节点文件夹在节点文件夹数组中的顺序 |
|
|
|
nowFolderIndex() { |
|
|
|
return this.nodeFolders && this.nodeFolders.indexOf(this.currentNodeFolder); |
|
|
@@ -522,6 +589,95 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
notPicIcon() { |
|
|
|
return !this.oneOf(this.currentSelectTempFile.extension, imgExtensionList) && !this.oneOf(this.currentSelectTempFile.extension, VideoExtensionList) |
|
|
|
}, |
|
|
|
picIcon() { |
|
|
|
return this.oneOf(this.currentSelectTempFile.extension, imgExtensionList); |
|
|
|
}, |
|
|
|
// 创建样本文件 |
|
|
|
async createTemplateFile() { |
|
|
|
console.log((this.workFileList[0])); |
|
|
|
let tempName = this.currentSelectTempFile.fileName; |
|
|
|
let temExtension = this.currentSelectTempFile.extension; |
|
|
|
//判断输入的名字是否重复 |
|
|
|
let isExists = this.workFileList.find(file => file.archName === tempName && file.extension == temExtension); |
|
|
|
while(isExists) { |
|
|
|
this.$notify({ |
|
|
|
message: `文件名重复 请重新输入。`, |
|
|
|
type: "warning", |
|
|
|
offset: 100, |
|
|
|
duration: 2500, |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
const time = new Date(); |
|
|
|
|
|
|
|
let file = { |
|
|
|
"projId":this.projectId, |
|
|
|
"folderId":"333570466176720897", |
|
|
|
"archName":tempName, |
|
|
|
"extension":temExtension, |
|
|
|
"ipfsCid":this.currentSelectTempFile.hash, |
|
|
|
"fileSize":this.currentSelectTempFile.fileSize, |
|
|
|
"folderLevelId":this.currentNodeFolder.levelId, |
|
|
|
"status":0, |
|
|
|
"workStatus":0, |
|
|
|
"commonStatus":0, |
|
|
|
"deleted":this.currentSelectTempFile.deleted, |
|
|
|
"milestone":0, |
|
|
|
"version":0, |
|
|
|
"showUrl":"", |
|
|
|
"createUserId":this.userId, |
|
|
|
"createTime":time, |
|
|
|
"modifyUserId":this.userId, |
|
|
|
"modifyTime":time, |
|
|
|
"isShowRecycle":0, |
|
|
|
"relativePath":""} |
|
|
|
|
|
|
|
const addFileRes = await services.addFile(file); |
|
|
|
if(addFileRes.Code == 0) { |
|
|
|
this.fetchFolderFiles(); |
|
|
|
this.isShowNewTemplateFileDialog = false; |
|
|
|
this.$notify({ |
|
|
|
message: `文件 “${tempName}” 创建成功。`, |
|
|
|
type: "success", |
|
|
|
offset: 100, |
|
|
|
duration: 2500, |
|
|
|
}); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
this.fetchFolderFiles(); |
|
|
|
this.isShowNewTemplateFileDialog = false; |
|
|
|
this.$notify({ |
|
|
|
message: `文件 “${tempName}” 创建失败 请稍后重试。`, |
|
|
|
type: "error", |
|
|
|
offset: 100, |
|
|
|
duration: 2500, |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
// 点击了样本文件 |
|
|
|
fileTempClick(item) { |
|
|
|
console.log(item); |
|
|
|
this.isShowNewTemplateFileDialog = true; |
|
|
|
this.currentSelectTempFile = item; |
|
|
|
}, |
|
|
|
// 加载样本文件列表 |
|
|
|
async loadListTempFiles() { |
|
|
|
if(this.nodeFolders && this.nodeFolders[this.nowFolderIndex]) { |
|
|
|
const nodeId = this.nodeFolders[this.nowFolderIndex].nodeId; |
|
|
|
const res = await queryAllTemplateNodeModelFile(nodeId); |
|
|
|
if (res.Code !== 0) return; |
|
|
|
if(res.Data.length > 0) { |
|
|
|
this.listTempFiles = res.Data.map(f => firstCharToLowerCase(f)); |
|
|
|
} else { |
|
|
|
this.listTempFiles = []; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
//预览文件 |
|
|
|
async filePreview(file,type){ |
|
|
|
const url = await services.filePreview(sessionStorage.companyId); |
|
|
@@ -880,6 +1036,7 @@ export default { |
|
|
|
this.breadcrumbFolderList = []; |
|
|
|
this.breadcrumbFolderListInCoop = []; |
|
|
|
this.fetchFolderFiles(); |
|
|
|
this.loadListTempFiles(); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 进入子文件夹 |
|
|
@@ -926,6 +1083,7 @@ export default { |
|
|
|
this.currentFolder = this.currentNodeFolder; |
|
|
|
this.currentFolderInCoop = this.currentNodeFolder; |
|
|
|
this.fetchFolderFiles(); |
|
|
|
this.loadListTempFiles(); |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 查询当前文件夹内容 |
|
|
@@ -1528,4 +1686,66 @@ export default { |
|
|
|
height: 600px; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.img-container { |
|
|
|
margin: 0 auto; |
|
|
|
} |
|
|
|
/* 新建样本文件弹框样式 */ |
|
|
|
.temp-file-dialog { |
|
|
|
|
|
|
|
/* 新建样板文件弹框的提示文件名 */ |
|
|
|
.guide-template-file-name { |
|
|
|
color: rgba(0, 0, 0, 1); |
|
|
|
font-size: 14px; |
|
|
|
text-align: center; |
|
|
|
font-family: PingFangSC-Regular; |
|
|
|
padding: 16px; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
<style lang="scss"> |
|
|
|
.temp-file-dialog { |
|
|
|
.el-dialog { |
|
|
|
background-color: #fcfcfc; |
|
|
|
|
|
|
|
.el-dialog__header { |
|
|
|
padding: 19px 0; |
|
|
|
} |
|
|
|
.el-dialog__body { |
|
|
|
padding: 0 !important; |
|
|
|
.el-form { |
|
|
|
padding: 20px 0 0 0; |
|
|
|
background-color: #f1f1f1; |
|
|
|
.el-form-item { |
|
|
|
margin:0 0 0 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.el-form-item__content { |
|
|
|
padding: 0 16px; |
|
|
|
.el-input__inner { |
|
|
|
background-color: #ddd; |
|
|
|
margin: 0 0 20px 0; |
|
|
|
} |
|
|
|
} |
|
|
|
.dialog-footer { |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
padding: 16px; |
|
|
|
} |
|
|
|
.el-dialog__footer { |
|
|
|
padding: 0; |
|
|
|
.el-button { |
|
|
|
border-radius: 8px; |
|
|
|
/* &.el-button--primary { |
|
|
|
background-color: #7850ff; |
|
|
|
} */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</style> |