Bläddra i källkod

新增从样板文件中创建文件

dev-remain
kim131 4 år sedan
förälder
incheckning
f8813ce546
10 ändrade filer med 385 tillägg och 16 borttagningar
  1. +16
    -2
      public/static/css/main.css
  2. +1
    -1
      src/services/template.js
  3. +15
    -7
      src/views/components_web/projDetail/components/personnel-list.vue
  4. +1
    -1
      src/views/main_web/index/index.vue
  5. +1
    -1
      src/views/main_web/proj-item.vue
  6. +108
    -0
      src/views/main_web/workspace/components/add-file-button.vue
  7. +4
    -1
      src/views/main_web/workspace/components/file-item.vue
  8. +17
    -1
      src/views/main_web/workspace/helper.js
  9. +221
    -1
      src/views/main_web/workspace/workspace.new.vue
  10. +1
    -1
      src/views/platform_center/index.vue

+ 16
- 2
public/static/css/main.css Visa fil

@@ -8510,9 +8510,9 @@ h5.dulilabel{
.bg_druk{
background-color: #adadad;
}
.listTemplateList li:hover,.slected{
/* .listTemplateList li:hover,.selected{
background-color: rgba(204, 205, 215, 1);
}
} */
.listTemplateList li{
height: 48px;
border-radius: 8px;
@@ -9011,4 +9011,18 @@ h5.dulilabel{
clear: both;
height: 0;
visibility: hidden;
}
/* 新建样本文件弹框显示的图片 */
.defultImage-small {
margin: 0 auto;
width: 70px;
height: 70px;
background: url(/static/img/defult-mid.png) center/100%;
}
.video-small {
height: 70px;
width: 70px;
background: url(/static/img/FileType/video.svg) center/100%;
margin: 0 auto;
}

+ 1
- 1
src/services/template.js Visa fil

@@ -83,7 +83,7 @@ export async function fileExchange(unit) {

/* 模板文件 */
/**
* 查询当前节点的文件目录
* 查询模板节点下的所有样本文件
* @param {string} nodeId
*/
export async function queryAllTemplateNodeModelFile(nodeId) {


+ 15
- 7
src/views/components_web/projDetail/components/personnel-list.vue Visa fil

@@ -19,16 +19,20 @@
<el-collapse-item>
<template slot="title" class="dept-entry">
<span class="dept-name">{{ dept.deptName }}</span>
<input type="checkbox" v-model="dept.selected"/>
<el-checkbox class="dept-select-all-btn" v-model="dept.selected" @change="handleCheckItemAll(group_index, $event)">全选</el-checkbox>
<div class="use-flex check-all-wrap">
<div class="checkbox" :class="{checked: dept.selected}"
@click="handleCheckItemAll(group_index, dept.selected)"/><span>全选</span>
</div>
<!-- <el-checkbox class="dept-select-all-btn" v-model="dept.selected" @change="handleCheckItemAll(group_index, dept.selected)">全选</el-checkbox> -->
</template>
<div class="user-info-item" v-for="user in dept.listUser" :label="user" :key="user.id" @click="
handleCheckedOne(
<div class="user-info-item" v-for="user in dept.listUser" :label="user" :key="user.id"
@click="handleCheckedOne(
group_index,
user,
$event
)
">
user.selected
)"
>
<img :src="user.headImgUrl | resolveAvator" alt="" class="avatar-img" />
<span class="user-info-name">{{user.cnName}}</span>
<div class="checkbox" :class="{checked:user.selected}"
@@ -204,6 +208,10 @@
.personnel-list .el-collapse-item__header {
margin: 0 4px 0 0 !important;
}
.check-all-wrap .checkbox {
width: 10px;
height: 10px;
}
.checkbox{
float: right;
width: 20px;


+ 1
- 1
src/views/main_web/index/index.vue Visa fil

@@ -44,7 +44,7 @@
<button
class="yiyun_btn_new"
id="buttonbtn"
@click.stop="createNewProjectClick"
@click.stop="showNewProj"
v-if="isUserPerm"
>新建项目</button>
</div>


+ 1
- 1
src/views/main_web/proj-item.vue Visa fil

@@ -111,7 +111,7 @@ export default {
methods:{
// 点击了项目管理按钮
lookProjDetailClick(projItem) {
this.$emit('lookProjDetailClick', projItem);
// this.$emit('lookProjDetailClick', projItem);
},
//项目管理
manageProj(){


+ 108
- 0
src/views/main_web/workspace/components/add-file-button.vue Visa fil

@@ -35,7 +35,47 @@
<img src="static\img\upload.png" alt class="uploadBtnImg" />
<span class="uploadText">点击上传本地文件夹</span>
</div>
<div class="creatbox_mid mt-10" v-if="listTempFiles.length > 0">
<div class="title-head">
<div class="title-text">从样板文件中创建</div>
</div>
<div class="temp-file-container">
<ul class="listTemplateList">
<li class="temp-file"
v-for="(item, index) in listTempFiles"
:key="item.id"
@click.stop="fileTempClick(item, index)"
>
<span class="listTemplateTextBig" :title="item.extension">{{
item.extension
}}</span>
<span class="listTemplateText">{{ item.fileName }}</span>
</li>
</ul>
</div>
</div>
</div>

<!-- <div
class="listimg"
:title="item.name"
>
<img
:src="
'/static/img/files/file_sample_' + item.extension + '.svg'
"
alt
/>
</div>
<div
class="listimg"
:title="item.name"
v-else
>
<img :src="'/static/img/files/file_sample_weizhi.svg'" alt />
<span class="houzuidinwei">{{ item.extension }}</span>
</div> -->
</div>
</div>
</template>
@@ -43,13 +83,24 @@
<script>
export default {
props: {
oneOf: Function,
onButtnClick: Function,
selectSystemFiles: Function,
selectSystemFolders: Function,
listTempFiles: {
type: Array,
default() {
return []
}
},
},
data() {
return {
selectedFileIndex: 0,//选择的样板文件的索引值
isShowNewFiledialog: false,
isShowNewTemplateFileDialog: false,//新建样板文件弹窗

}
},
methods: {
@@ -70,6 +121,11 @@ export default {
hideNewFiledialog: function () {
this.isShowNewFiledialog = false;
},
//点击了样板文件
fileTempClick(item, index) {
this.$emit('fileTempClick', item);
this.hideNewFiledialog();
}
}
}
</script>
@@ -78,4 +134,56 @@ export default {
.uploadBtn ~ .uploadBtn {
margin-top: 10px;
}
.temp-file-container {
height:calc(100vh - 434px);
overflow: scroll;

background-color: #f1f1f1;
padding: 20px 10px 12px;
text-align: left;
.temp-file {
background-color: #fff;
&:hover {
background-color: #d5d5d6;
}
}
}

/* 样板文件超出滚动条 */
.temp-file-container::-webkit-scrollbar {
width: 8px;
height: 8px;
padding: 0 4px 0 0;
border-radius: 4px;
}

/*滑块样式*/
.temp-file-container::-webkit-scrollbar-thumb {
-webkit-border-radius: 4px;
border-radius: 4px;
height: 300px;
background-color: #adadad;
}

/*当前窗口失去焦点时的滑块样式*/
.temp-file-container::-webkit-scrollbar-thumb:window-inactive {
background-color: #adadad;
}
.title-head {
padding: 19px 24px;
.title-text {
color: rgba(50, 50, 60, 100);
font-size: 20px;
text-align: left;
font-family: PingFangSC-Medium;
}
}
.new-template-file-dialog {
.title-text {
font-size: 18px;
}
}

</style>

+ 4
- 1
src/views/main_web/workspace/components/file-item.vue Visa fil

@@ -486,9 +486,12 @@ export default {

</style>

<style>
<style lang="scss">
.loding-mask-parent {
position: relative;
.el-loading-mask {
z-index: 9 !important;
}
}
/* 设置蒙版的位置 */
.set-loding-mask-position {


+ 17
- 1
src/views/main_web/workspace/helper.js Visa fil

@@ -87,4 +87,20 @@ export class VirtualFolder {
this.childCount = 0;
this.fileCount = 0;
}
}
}

export const imgExtensionList = ["jpg", "png", "bmp", "gif", "jpeg"];
export const RecExtensionList = ["jpg", "png", "bmp", "gif", "jpeg", "txt",
"zip", "ae", "ai", "idml","indd","mp3","pr",
"ps","sketch","xmind","skp","rvt","rar","nwc",
"max","dxf","dwg","svfzip","map","supermap","pdf",
"ppt","pptx","excel","xlsx","xls","doc","docx",
"word","folder","folder1","folder2"
];
export const VideoExtensionList = ["avi", "mov", "wav","mp4"];
export const office =["doc","docx","ppt","pptx","xls","xlsx"];
export const filePreviewList = ["jpg", "png", "bmp", "gif", "jpeg",
"doc","docx","ppt","pptx","xls","xlsx",
"avi", "mov", "wav","mp4","txt","pdf",
"dwg"
];

+ 221
- 1
src/views/main_web/workspace/workspace.new.vue Visa fil

@@ -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>

+ 1
- 1
src/views/platform_center/index.vue Visa fil

@@ -99,7 +99,7 @@ export default {
: isCompanyConsole
? "/company"
: "/index",
});
}).catch(err => console.log(err))
},
// onBackBtnClick() {
// console.log("???");


Laddar…
Avbryt
Spara