Auteur | SHA1 | Bericht | Datum |
---|---|---|---|
|
a2fa13bafc | 修正上传和下载的路径 | 4 jaren geleden |
|
b4066e278d | merge | 4 jaren geleden |
|
73f966b63b | 增加批量上传的功能 | 4 jaren geleden |
|
3bd9d2fe37 | 拉取代码 合并新增企业编辑企业冲突 | 4 jaren geleden |
|
8f4803506f | 调整文件的上传策略 | 4 jaren geleden |
|
95451d06b1 | 弹窗信息修改 新增企业取消按钮bug修改 | 4 jaren geleden |
|
cf8e05f594 | Merge branch 'dev' of http://47.104.91.134:3000/yiyun-fe/yiyunjianzhu-vue into dev | 4 jaren geleden |
|
eec43c1bac | 弹窗信息 | 4 jaren geleden |
@@ -6704,6 +6704,7 @@ h4.biaoqianweizhi2{ | |||
font-size: 18px; | |||
color: #000; | |||
text-align-last: center; | |||
text-align: center; | |||
} | |||
.el-message-box .el-message-box__btns .el-button{ | |||
width: 210px; | |||
@@ -8721,7 +8722,7 @@ h5.dulilabel{ | |||
display: inline-block; | |||
width: 28px; | |||
height: 28px; | |||
background-color: #ccc; | |||
background-color: #ccc; | |||
background: url(/static/img/icon_pic_01.png) no-repeat -180px 0px; | |||
} | |||
.selfupdate .webuploader-pick{ | |||
@@ -66,7 +66,7 @@ const system = { | |||
}); | |||
watchSocket.on('message', fileChangeHandler); | |||
watchSocket.on('error', errorHandler); | |||
return watchSocket | |||
return watchSocket; | |||
}), | |||
/** | |||
* todo | |||
@@ -85,7 +85,7 @@ const system = { | |||
}); | |||
socket.on('message', (e) => { | |||
if(e.data === '-1') { | |||
notify.error('文件下载失败'); | |||
notify.error('文件下载失败,请检查网络。'); | |||
onErrorHandler(e); | |||
return; | |||
} | |||
@@ -100,16 +100,178 @@ const system = { | |||
onErrorHandler(e); | |||
}); | |||
}), | |||
// 解析文件/文件夹路径信息 | |||
// { | |||
// name: '11-28会议纪要.docx', | |||
// extension:".docx", | |||
// relativePath:"协同项目\\分析\\11-28会议纪要.docx", | |||
// absolutePath:"C:\\Users\\yuan_rh\\easycloud\\332174685636661248\\协同项目\\分析\\11-28会议纪要.docx" | |||
// } | |||
analyzeSystemPath: safeCall(async (systemFullpath) => { | |||
const response = await requestBySocket(io('getFolderFileInfo'), systemFullpath); | |||
try { | |||
const obj = JSON.parse(response.data); | |||
const uploadTasks = Object.values(obj).map((data) => { | |||
const { name: extensionedFileName, extension: dotExtension, relativePath, absolutePath } = data; | |||
const extension = dotExtension.indexOf('.') === 0 ? dotExtension.slice(1) : dotExtension; | |||
const fileName = extensionedFileName.slice(0, -dotExtension.length); | |||
return { | |||
fileName, | |||
extension, | |||
relativePath: relativePath.replace(/(\\)+/g, '/'), | |||
fullPath: absolutePath, | |||
}; | |||
}); | |||
return uploadTasks; | |||
} catch(e) { | |||
return []; | |||
} | |||
}), | |||
// 选择文件 | |||
chooseFiles: safeCall(async () => { | |||
const { ipcRenderer } = global.electron; | |||
const res = await ipcRenderer.invoke('project-choose-files'); | |||
const { canceled, filePaths } = res; | |||
if(canceled) return null; | |||
return filePaths; | |||
}), | |||
// 选择文件 | |||
chooseFolders: safeCall(async () => { | |||
const { ipcRenderer } = global.electron; | |||
const res = await ipcRenderer.invoke('project-choose-folders'); | |||
const { canceled, filePaths } = res; | |||
if(canceled) return null; | |||
return filePaths; | |||
}), | |||
/** | |||
* 上传文件到工作空间 | |||
* 程序步骤: | |||
* + 用户选择本地文件/文件夹 | |||
* + 文件上传至本地ipfs节点 | |||
* + 将文件的ipfsCid连同文件信息发送到远端服务器 | |||
* @param {params.projectId} 项目Id | |||
* @param {params.projectName} 项目名称 | |||
* @param {params.folderId} 节点文件夹Id | |||
* @param {params.folderName} 节点文件夹Id | |||
* @param {params.folderLevelId} 节点文件夹levelId | |||
* @param {params.distFileRelativePath} 节点文件夹下的相对路径, 直接在节点文件夹下则为空, 用正斜杠 | |||
* @param {params.sourceFilePath} 上传文件的完整路径 | |||
* @param {params.fileName} 上传文件名 | |||
* @param {params.fileExtension} 上传文件名 | |||
* @param {params.fileList} 用于对比文件名是否重复的文件队列 | |||
* @param {params.onSuccessHandler} 完成上传时的回调 | |||
* @param {params.onProgressHandler} 上传进度反馈的回调 | |||
* @param {params.onErrorHandler} 上传失败的回调 | |||
* | |||
*/ | |||
uploadFile: safeCall(async (params) => { | |||
const { | |||
projectId, projectName, | |||
folderId, folderName, folderLevelId, distFileRelativePath = '', | |||
fileName, fileExtension, sourceFilePath, | |||
fileList, onSuccess: onSuccessHandler, onProgress: onProgressHandler = identity, onError: onErrorHandler = identity | |||
} = params; | |||
const extensionedFileName = fileExtension ? `${fileName}.${fileExtension}`: fileName; | |||
const distFilePath = `${folderName}/${distFileRelativePath}`; | |||
const maybeFile = fileList.find(iFile => distFileRelativePath === iFile.relativePath && `${iFile.archName}${iFile.extension ? `.${iFile.extension}` : ''}` === extensionedFileName); | |||
// 检测当前工作目录中是否存在同名文件 | |||
if(maybeFile) { | |||
let confirmRes = false; | |||
try { | |||
await Vue.prototype.$confirm('监测到文件夹存在同名文件,是否继续上传并覆盖同名文件?'); | |||
confirmRes = true; | |||
} catch(e) { console.log('user canceled'); } | |||
if(!confirmRes) return; | |||
} | |||
const uploadFile = maybeFile | |||
? firstCharToUpperCase({ ...maybeFile, ModifyUserId: sessionStorage.userId }) | |||
: { | |||
// 文件名称 不带扩展名 | |||
ArchName: fileName, | |||
// CommonStatus: 0, | |||
// CreateTime: "string", | |||
// 文件上传者Id | |||
CreateUserId: sessionStorage.userId, | |||
// Deleted: 0, | |||
Extension: fileExtension, | |||
// 文件大小 单位? | |||
// FileSize: +size, | |||
// 所处文件夹id | |||
FolderId: folderId, | |||
// 所处文件夹层级,拼接符:_ | |||
FolderLevelId: folderLevelId, | |||
Id: `upload:${`${Math.random()}`.slice(2, 8)}`, | |||
// IpfsCid: hash, | |||
// IsShowRecycle: 0, | |||
// Milestone: 0, | |||
// ModifyTime: "string", | |||
// ModifyUserId: 0, | |||
// 项目id | |||
ProjId: projectId, | |||
RelativePath: distFileRelativePath, | |||
// ShowUrl: "string", | |||
Status: 2, | |||
Version: 1, | |||
// WorkStatus: 0 | |||
}; | |||
const socket = io('upload'); | |||
socket.on('open', () => { | |||
const data = [sourceFilePath, extensionedFileName, projectName, distFilePath].join('|'); | |||
socket.send(data); | |||
onProgressHandler({ process: 0 }, uploadFile); | |||
}); | |||
socket.on('message', async (e) => { | |||
console.log('receive download file message:', e); | |||
if(e.data === '-1') { | |||
notify.error('文件上传失败'); | |||
onErrorHandler(e, uploadFile); | |||
return; | |||
} | |||
if(e.data === '-2') { | |||
notify.error('请先关闭本地文件后再上传'); | |||
onErrorHandler(e, uploadFile); | |||
return; | |||
} | |||
try { | |||
const progressData = JSON.parse(e.data); | |||
const { size, process, hash } = progressData; | |||
onProgressHandler(progressData, uploadFile); | |||
if(process !== 100 || !hash) return; | |||
socket.close(); | |||
// {"size":"88.69","currentSize":"88.69","unit":"KiB","process":100,"hash":""} | |||
// {"size":"","currentSize":"","unit":"","process":100,"hash":"QmPJ9i4z5UdoQpLH1DrkhZiTZra2rGicXiPabiLw4LvTmX"} | |||
// const maybeFile = fileList.find(iFile => `${iFile.archName}${iFile.extension ? `.${iFile.extension}` : ''}` === extensionedFileName); | |||
uploadFile.FileSize = +size; | |||
uploadFile.IpfsCid = hash; | |||
if(!maybeFile) { | |||
delete uploadFile.Id; | |||
} | |||
const res = await fetchApi(`file/${maybeFile ? 'updateFile' : 'addFile'}`, uploadFile); | |||
wrapErrorHint(res); | |||
if(res.Code !== 0) return; | |||
//notify.success(maybeFile ? '上传成功, 已覆盖同名文件' : '上传成功'); | |||
notify.success('文件已上传。') | |||
onSuccessHandler(uploadFile); | |||
} catch (e) { | |||
console.error('socket-upload-file parse data have error:', e); | |||
onErrorHandler(e, uploadFile); | |||
} | |||
}); | |||
socket.on('error', e => { | |||
onErrorHandler(e, uploadFile); | |||
}); | |||
}), | |||
/** | |||
* 上传文件到工作空间 | |||
* issue: | |||
* + 浏览器的文件上传不会带有本地的文件路径,本地服务是否可以唤起一个选择文件的弹窗? | |||
* 程序步骤: | |||
* + 用户选择本地文件 | |||
* + 用户选择本地文件/文件夹 | |||
* + 文件上传至本地ipfs节点 | |||
* + 将文件的ipfsCid连同文件信息发送到远端服务器 | |||
*/ | |||
uploadFile: safeCall(async (projectId, projectName, folderId, folderName, levelId, fileList, onSuccessHandler, onProgressHandler = identity, onErrorHandler = identity) => { | |||
uploadFileOld: safeCall(async (projectId, projectName, folderId, folderName, levelId, fileList, onSuccessHandler, onProgressHandler = identity, onErrorHandler = identity) => { | |||
const { ipcRenderer } = global.electron; | |||
const res = await ipcRenderer.invoke('project-upload-file'); | |||
console.log('ipcRenderer project-selected-upload-file: ', res); | |||
@@ -174,7 +336,7 @@ const system = { | |||
socket.on('message', async (e) => { | |||
console.log('receive download file message:', e); | |||
if(e.data === '-1') { | |||
notify.error('文件上传失败'); | |||
notify.error('文件上传失败,请检查网络。'); | |||
onErrorHandler(e, uploadFile); | |||
return; | |||
} | |||
@@ -215,13 +377,13 @@ const system = { | |||
/** | |||
* 更新本地文件 | |||
*/ | |||
updateFile: safeCall((file, localFilePathPrefix, projectName, folderName, onSuccessHandler, onProgressHandler = identity, onErrorHandler = identity) => { | |||
updateFile: safeCall((file, localFilePathPrefix, projectName, relativePath, onSuccessHandler, onProgressHandler = identity, onErrorHandler = identity) => { | |||
const socket = io('upload'); | |||
const { archName, extension, id: fileId } = file; | |||
const extensionedFileName = `${archName}${extension ? `.${extension}` : ''}`; | |||
const filePath = `${localFilePathPrefix}\\${folderName}\\${extensionedFileName}`; | |||
const filePath = `${localFilePathPrefix}\\${relativePath}\\${extensionedFileName}`; | |||
socket.on('open', () => { | |||
const data = [filePath, extensionedFileName, projectName, folderName].join('|'); | |||
const data = [filePath, extensionedFileName, projectName, relativePath].join('|'); | |||
socket.send(data); | |||
}); | |||
socket.on('message', async (e) => { | |||
@@ -60,19 +60,19 @@ export async function fetchApi(path, params, config) { | |||
case 404: | |||
return { | |||
Code: 404, | |||
Msg: '找不到指定的服务', | |||
Msg: '找不到指定的服务。', | |||
}; | |||
default: | |||
return { | |||
Code: 503, | |||
Msg: '服务异常,请稍后再试', | |||
Msg: '服务异常,请稍后再试。', | |||
}; | |||
} | |||
} | |||
console.error(e); | |||
return { | |||
Code: 503, | |||
Msg: '服务异常,请稍后再试', | |||
Msg: '服务异常,请稍后再试。', | |||
}; | |||
} | |||
} | |||
@@ -1459,7 +1459,6 @@ | |||
},3000) | |||
} else { | |||
thisApp.$notify.error({ | |||
title: '温馨提示', | |||
message: res.Msg, | |||
offset: 100, | |||
duration: 5000, | |||
@@ -1537,8 +1536,7 @@ | |||
goprojInfo: function() { | |||
if (this.newProjData.projectData.projName == undefined || this.newProjData.projectData.projName == null || | |||
this.newProjData.projectData.projName == "") { | |||
this.$notify({ | |||
this.$notify({ | |||
message: "请输入项目名称。", | |||
type: "warning", | |||
offset: 100, | |||
@@ -1548,8 +1546,7 @@ | |||
} | |||
let rg = /[/\\]{1,}/g; | |||
if (rg.test(this.newProjData.projectData.projName)) { | |||
this.$notify({ | |||
this.$notify({ | |||
message: "项目名称请不要包含'/' '\\'等字符。", | |||
type: "warning", | |||
offset: 100, | |||
@@ -1559,8 +1556,7 @@ | |||
} | |||
if (this.newProjData.projectData.templateID == undefined || this.newProjData.projectData.templateID == null || | |||
this.newProjData.projectData.templateID == "") { | |||
this.$notify({ | |||
this.$notify({ | |||
message: "请选择工作链。", | |||
type: "warning", | |||
offset: 100, | |||
@@ -737,7 +737,7 @@ import { wrapOssProtocol} from "@/services/oss"; | |||
// },2000) | |||
} else { | |||
this.$notify({ | |||
message: '项目信息修改出现错误.', | |||
message: '项目信息修改出现错误。', | |||
type: "error", | |||
offset: 30, | |||
duration: 5000 | |||
@@ -23,11 +23,18 @@ | |||
<div class="dragareaBox"> | |||
<div | |||
class="dragarea_top uploadBtn" | |||
@click="clientUpload(), isShowNewFiledialog = false" | |||
@click="selectSystemFiles(), isShowNewFiledialog = false" | |||
> | |||
<img src="static\img\upload.png" alt class="uploadBtnImg" /> | |||
<span class="uploadText">点击上传本地文件</span> | |||
</div> | |||
<div | |||
class="dragarea_top uploadBtn" | |||
@click="selectSystemFolders(), isShowNewFiledialog = false" | |||
> | |||
<img src="static\img\upload.png" alt class="uploadBtnImg" /> | |||
<span class="uploadText">点击上传本地文件夹</span> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -37,7 +44,8 @@ | |||
export default { | |||
props: { | |||
onButtnClick: Function, | |||
clientUpload: Function, | |||
selectSystemFiles: Function, | |||
selectSystemFolders: Function, | |||
}, | |||
data() { | |||
return { | |||
@@ -132,8 +132,8 @@ | |||
<ul class="rightMenu fileRightMenu"> | |||
<li v-if="fileInLocal" @click.stop="openfileBtnClick">打开</li> | |||
<li v-else class="function-disabled" title="请先下载文件再打开">打开</li> | |||
<li v-if="!isCoorFile" @click.stop="copyFileBtnClick">创建文件副本</li> | |||
<li v-if="!isCoorFile" @click.stop="deleteFileClick">移动到回收站</li> | |||
<li v-if="isInWorkFolder" @click.stop="copyFileBtnClick">创建文件副本</li> | |||
<li v-if="isInWorkFolder" @click.stop="deleteFileClick">移动到回收站</li> | |||
</ul> | |||
</div> | |||
@@ -190,7 +190,7 @@ | |||
<script> | |||
import system from "@/services/system"; | |||
import LottieSvg from '@/components/lottieSvg'; | |||
import { FileWorkStatus, LoadingEnum } from '../helper'; | |||
import { FileWorkStatus, getFileStoreKey, LoadingEnum } from '../helper'; | |||
const imgExtensionList = ["jpg", "png", "bmp", "gif", "jpeg"]; | |||
const oneOf = (target, list) => list.indexOf(target) !== -1 | |||
@@ -206,10 +206,6 @@ export default { | |||
type: Object, | |||
default: () => ({}), | |||
}, | |||
isCoorFile: {//是否是协作文件 | |||
type: Boolean, | |||
default: false | |||
}, | |||
// rightShowMenu: { | |||
// type: Function, | |||
// default: () => () => {} | |||
@@ -259,13 +255,13 @@ export default { | |||
}, | |||
computed: { | |||
fileStoreKey() { | |||
const { nodeName, extension, archName } = this.file; | |||
const { nodeName, extension, archName, relativePath } = this.file; | |||
const folderName = nodeName ? `${nodeName}\\协作文件` : this.nodeFolder.folderName; | |||
return `${folderName}\\${archName}${extension ? `.${extension}` : ''}`; | |||
return getFileStoreKey(this.file, this.nodeFolder); | |||
}, | |||
isInWorkFolder() { | |||
const { file, currentFolder } = this; | |||
return file.folderId === currentFolder.id; | |||
return file.folderId === this.nodeFolder.id; | |||
}, | |||
localIpfsCid() { | |||
return this.localFileHashMap[this.fileStoreKey]; | |||
@@ -60,7 +60,18 @@ export const FileStatus = { | |||
* @param {*} nodeFolder | |||
*/ | |||
export const getFileStoreKey = (file, nodeFolder) => { | |||
const { nodeName, extension, archName } = file; | |||
const { nodeName, extension, archName, relativePath } = file; | |||
const folderName = nodeName ? `${nodeName}\\协作文件` : nodeFolder.folderName; | |||
return `${folderName}\\${archName}${extension ? `.${extension}` : ''}`; | |||
return `${folderName}\\${relativePath ? `${relativePath.replace(/\//g, '\\')}\\`:''}${archName}${extension ? `.${extension}` : ''}`; | |||
} | |||
export class VirtualFolder { | |||
constructor(id, folderName, parentFolderPath){ | |||
this.id = id; | |||
this.folderPath = id; | |||
this.folderName = folderName; | |||
this.parentFolderPath = parentFolderPath; | |||
this.childCount = 0; | |||
this.fileCount = 0; | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
import { fetchApi, wrapErrorHint } from '@/utils/request'; | |||
import { firstCharToLowerCase, firstCharToUpperCase } from '@/utils/tool'; | |||
import { VirtualFolder } from './helper'; | |||
export async function fetchWorkFlow(projectId, userId) { | |||
const res = await fetchApi('folder/queryNodeFolderListByProjectIdAndUserId', { projectId, userId }); | |||
@@ -23,15 +23,36 @@ export async function fetchFolderFileList(folderId, userId, commonFolderId) { | |||
wrapErrorHint(res); | |||
if (res.Code !== 0) return null; | |||
const data = res.Data || {}; | |||
const injectFileBasicValue = upperCaseFile => { | |||
const file = firstCharToLowerCase(upperCaseFile); | |||
return file; | |||
} | |||
const folderList = []; | |||
const folderMap = {}; | |||
const fileList = (data.myFile || []).concat(data.workFile || []) | |||
.map(uppercaseFile => { | |||
const file = firstCharToLowerCase(uppercaseFile); | |||
const relativePath = file.relativePath; | |||
if(relativePath) { | |||
const paths = relativePath.split('/'); | |||
paths.forEach((folderName, idx) => { | |||
const fullRelativePath = paths.slice(0, idx + 1).join('/'); | |||
if(folderMap[fullRelativePath]) return; | |||
const parentRelativePath = paths.slice(0, idx).join('/'); | |||
const folder = new VirtualFolder(fullRelativePath, folderName, parentRelativePath); | |||
folderList.push(folder); | |||
folderMap[fullRelativePath] = folder; | |||
if(folderMap[parentRelativePath]) { | |||
folderMap[parentRelativePath].childCount++; | |||
} | |||
}); | |||
folderMap[relativePath].fileCount++; | |||
} | |||
return file; | |||
}); | |||
const outputObj = { | |||
folder: (data.folder || []).map(firstCharToLowerCase), | |||
myFile: (data.myFile || []).map(injectFileBasicValue), | |||
workFile: (data.workFile || []).map(injectFileBasicValue), | |||
coordinationFiles: (data.coordinationFiles || []).map(injectFileBasicValue), | |||
folder: folderList, | |||
folderMap, | |||
file: fileList, | |||
// myFile: (data.myFile || []).map(injectFileBasicValue), | |||
// workFile: (data.workFile || []).map(injectFileBasicValue), | |||
coordinationFiles: (data.coordinationFiles || []).map(firstCharToLowerCase), | |||
// public: (data.public || []).map(firstCharToLowerCase), | |||
} | |||
return outputObj; | |||
@@ -63,7 +63,8 @@ | |||
> | |||
<AddFileButton | |||
v-if="isClient" | |||
:clientUpload="clientUpload" | |||
:selectSystemFiles="selectSystemFiles" | |||
:selectSystemFolders="selectSystemFolders" | |||
/> | |||
<!-- 文件上传队列 --> | |||
<div class="list-group"> | |||
@@ -115,7 +116,7 @@ | |||
<div class="list-group"> | |||
<FileItem | |||
class="lisy-group-item" | |||
v-for="file in removeMilestone(workFileList)" | |||
v-for="file in filterFiles(workFileList)" | |||
:key="file.id" | |||
:file="file" | |||
:clientDownLoad="clientDownLoad" | |||
@@ -138,10 +139,10 @@ | |||
<!--显示文件夹组 --> | |||
<div class="list-group"> | |||
<FolderItem | |||
v-for="folder in workSubFolderList" | |||
v-for="folder in filterFolders(subFolderList)" | |||
:key="folder.id" | |||
:folder="folder" | |||
@dblclick.native="infoSubFolder(folder)" | |||
@dblclick.native="intoSubFolder(folder)" | |||
:rightShowMenu="rightShowMenu" | |||
/> | |||
</div> | |||
@@ -206,7 +207,6 @@ | |||
:nodeFolder="currentNodeFolder" | |||
:currentFolder="currentFolder" | |||
@dblclick.native="fileClick(file)" | |||
isCoorFile=true | |||
:localFileHashMap="localFileHashMap" | |||
:loadingState="localFileLoadStateMap[file.id]" | |||
@dragstart.native="onfileDragStart(file, $event)" | |||
@@ -262,13 +262,13 @@ | |||
<el-form-item> | |||
<el-input | |||
v-model="folderGroupData.FolderName" | |||
@keyup.enter.native="createFolder" | |||
@keyup.enter.native="createSubFolder" | |||
></el-input> | |||
</el-form-item> | |||
</el-form> | |||
<div slot="footer" class="dialog-footer"> | |||
<el-button @click="dialogNewFolderGroup = false">取 消</el-button> | |||
<el-button @click="createFolder()" type="primary">确 定</el-button> | |||
<el-button @click="createSubFolder()" type="primary">确 定</el-button> | |||
</div> | |||
</el-dialog> | |||
</div> | |||
@@ -295,8 +295,8 @@ 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 } from './helper'; | |||
import { propertyOf } from 'lodash'; | |||
import { FileWorkStatus, getFileStoreKey, injectionFileLocalStatus, LoadingEnum, VirtualFolder } from './helper'; | |||
import { propertyOf, uniqBy } from 'lodash'; | |||
const $ = window.jQuery; | |||
const Velocity = window.Velocity; | |||
@@ -373,12 +373,14 @@ export default { | |||
localWorkspacePrefix: '', // 本地工作目录前缀 | |||
socketIns: null, // 监听文件变化的socket实例 | |||
timerIns: null, // 文件定时任务实例 | |||
folderMap: {}, // 文件夹id哈希: { [folderId]: folder } | |||
folderMap: {}, // 节点文件夹id哈希: { [folderId]: folder } | |||
subFolderMap: {}, // 子文件夹哈希: { [folderPath]: VirtualFolder } | |||
breadcrumbFolderList: [], // 面包屑导航对应的文件夹队列 | |||
uploadFileList: [], // 上传文件的队列 | |||
workFileList: [], // 工作文件队列 | |||
workSubFolderList: [], // 工作文件夹队列 | |||
tempWorkSubFolderList: [], // 临时的工作文件夹队列 | |||
cooperationFileList: [], // 协作文件队列 | |||
neibianju: "neibianju", // 协作文件槽样式 | |||
@@ -404,9 +406,9 @@ export default { | |||
mounted: function () { | |||
window.addEventListener("scroll", this.onscroll, true); | |||
window.addEventListener("resize", this.listenBottomHeight, true); | |||
// if(this.isClient) { | |||
// this.initWorkspaceDropEvent(); | |||
// } | |||
if(this.isClient) { | |||
this.initWorkspaceDropEvent(); | |||
} | |||
//添加鼠标移入齿轮事件 | |||
// window.addEventListener("mouseenter", this.setIconMouseEnter, true); | |||
this.fetchNodeFolders(); | |||
@@ -435,6 +437,10 @@ export default { | |||
// 当前节点文件夹的名称 | |||
nowFolderName() { | |||
return this.currentNodeFolder.folderName; | |||
}, | |||
subFolderList() { | |||
const uniqSubFolderList = uniqBy(this.workSubFolderList.concat(this.tempWorkSubFolderList), folder => folder.id); | |||
return uniqSubFolderList | |||
} | |||
}, | |||
methods: { | |||
@@ -442,11 +448,30 @@ export default { | |||
oneFileRightBtnClick(id) { | |||
this.tempRightFileId = id; | |||
}, | |||
removeMilestone(filesList){ | |||
return filesList.filter(file=>{ | |||
return file.milestone != 2; | |||
}) | |||
// 文件展示过滤 | |||
filterFiles(fileList) { | |||
// 子文件会有这个属性,节点文件夹不会有 | |||
const { folderPath = '' } = this.currentFolder; | |||
return fileList.filter(file => { | |||
if(file.relativePath !== folderPath) return false; | |||
return true; | |||
}); | |||
}, | |||
// 文件展示过滤 | |||
filterFolders(folderList) { | |||
// 子文件会有这个属性,节点文件夹不会有 | |||
const { folderPath = '' } = this.currentFolder; | |||
return folderList.filter(folder => { | |||
if(folder.parentFolderPath !== folderPath) return false; | |||
return true; | |||
}); | |||
}, | |||
// removeMilestone(filesList){ | |||
// return filesList.filter(file=>{ | |||
// return file.milestone != 2; | |||
// }) | |||
// }, | |||
oneOf(target, list) { | |||
return list.indexOf(target) !== -1; | |||
}, | |||
@@ -461,17 +486,14 @@ export default { | |||
// 从客户端外拖入文件并上传 | |||
fileDropEvent(e) { | |||
// todo 目前无法区分文件夹和其他浏览器不能识别的文件类型。 | |||
const file = propertyOf(e)('dataTransfer.files.0'); | |||
if(!file) return; | |||
if(!file.type) { | |||
notify.error('文件夹或无扩展名文件不能上传'); | |||
return; | |||
} | |||
// 检测是否是从 | |||
debugger; | |||
const filePath = file.path; | |||
console.log(e); | |||
debugger; | |||
const files = propertyOf(e)('dataTransfer.files'); | |||
if(!files || files.length === 0) return; | |||
const itemPaths = Array.from(files).map(file => file.path); | |||
itemPaths.forEach(async fullPath => { | |||
const maybeTasks = await system.analyzeSystemPath(fullPath); | |||
const tasks = maybeTasks || []; | |||
tasks.forEach(uploadTask => this.clientUpload(uploadTask)); | |||
}); | |||
}, | |||
stopPropagation(e) { | |||
e.stopPropagation(); | |||
@@ -623,16 +645,17 @@ export default { | |||
this.clearCurrentFolderFiles(); | |||
} | |||
this.currentFolder = this.currentNodeFolder; | |||
this.breadcrumbFolderList = []; | |||
this.fetchFolderFiles(); | |||
}, | |||
/** | |||
* 进入子文件夹 | |||
*/ | |||
infoSubFolder(folder) { | |||
intoSubFolder(folder) { | |||
this.currentFolder = folder; | |||
this.breadcrumbFolderList.push(folder); | |||
this.clearCurrentFolderFiles(); | |||
this.fetchFolderFiles(); | |||
// this.clearCurrentFolderFiles(); | |||
// this.fetchFolderFiles(); | |||
}, | |||
/** | |||
* 当前工作点击 | |||
@@ -667,18 +690,19 @@ export default { | |||
* 查询当前文件夹内容 | |||
*/ | |||
async fetchFolderFiles() { | |||
const currentFolder = this.currentFolder; | |||
const nodeFolder = this.currentNodeFolder; | |||
const userId = this.userId; | |||
if(!currentFolder || !currentFolder.id) return; | |||
if(!nodeFolder || !nodeFolder.id) return; | |||
// 先清空当前的文件队列 在这清空队列会有闪烁问题,得放在切换显示文件夹内容的地方触发 | |||
// this.uploadFileList = []; | |||
// this.workFileList = []; | |||
// this.workSubFolderList = []; | |||
// this.cooperationFileList = []; | |||
// todo 接口去除公共文件夹配置 | |||
const folderResInfo = await services.fetchFolderFileList(currentFolder.id, userId, currentFolder.id); | |||
const folderResInfo = await services.fetchFolderFileList(nodeFolder.id, userId, nodeFolder.id); | |||
if(!folderResInfo) return; | |||
this.workFileList = folderResInfo.myFile.concat(folderResInfo.workFile); | |||
this.workFileList = folderResInfo.file; | |||
this.subFolderMap = { ...this.subFolderMap, ...folderResInfo.folderMap }; | |||
this.resolveUploadFileList(this.workFileList); | |||
this.workSubFolderList = folderResInfo.folder; | |||
this.cooperationFileList = folderResInfo.coordinationFiles; | |||
@@ -696,35 +720,23 @@ export default { | |||
/** | |||
* 点击确定 保存文件夹组 | |||
*/ | |||
async createFolder(){ | |||
async createSubFolder(){ | |||
if (!this.folderGroupData.FolderName) { | |||
notify.error('请输入文件夹名称!'); | |||
return; | |||
} | |||
this.folderGroupData = { | |||
Id: this.userId, | |||
ProjId:this.projectId, | |||
SuperId:this.currentFolder.id, //this.dbClickSelectedFolderGroupData.id,//this.nowFolder.id, | |||
FirstFolderId: this.currentNodeFolder.firstFolderId, | |||
FolderName: this.folderGroupData.FolderName, | |||
TemplateId: this.currentNodeFolder.templateId, | |||
SysCode: this.currentNodeFolder.sysCode, | |||
FileCount:0, | |||
ChildCount:0, | |||
Deleted:0, | |||
Customed:2, | |||
CreateUserId:this.userId, | |||
CreateTime: new Date(), | |||
ModifyUserId:this.userId, | |||
ModifyTime: new Date(), | |||
} | |||
const Res = await services.createSubFolder(this.folderGroupData); | |||
if (Res.Code != -1) { | |||
this.fetchFolderFiles(); | |||
notify.success('文件夹创建成功!'); | |||
const folderName = this.folderGroupData.FolderName; | |||
const parentFolderPath = this.currentFolder.folderPath || ''; | |||
const folderPath = parentFolderPath ? `${parentFolderPath}/${folderName}` : folderName; | |||
if(this.subFolderMap[folderPath]) { | |||
notify.error('创建失败,已存在同名文件夹!'); | |||
return; | |||
} | |||
const newVirtualFolder = new VirtualFolder(folderPath, folderName, parentFolderPath); | |||
this.subFolderMap[folderPath] = newVirtualFolder; | |||
this.tempWorkSubFolderList.push(newVirtualFolder); | |||
notify.success('文件夹创建成功!'); | |||
this.dialogNewFolderGroup = false; | |||
}, | |||
/** | |||
* 新建文件夹显示弹窗 | |||
@@ -752,23 +764,59 @@ export default { | |||
this.breadcrumbFolderList = this.breadcrumbFolderList.slice(0, breadFolderIdx + 1); | |||
}, | |||
/** | |||
* 客户端上传文件 | |||
* 客户端选择文件列表并上传 | |||
*/ | |||
clientUpload() { | |||
async selectSystemFiles() { | |||
if(!this.isClient) return; | |||
const { folderName, levelId, id: folderId } = this.currentFolder; | |||
// console.log(folderName, levelId, folderId); | |||
system.uploadFile( | |||
this.projectId, this.projectName, folderId, folderName, levelId, this.workFileList, | |||
(file) => { // onSuccess | |||
const {ArchName, IpfsCid, Extension} = file; | |||
const filePaths = await system.chooseFiles(); | |||
if(!filePaths) return; | |||
filePaths.forEach(async fullPath => { | |||
const maybeTasks = await system.analyzeSystemPath(fullPath); | |||
const tasks = maybeTasks || []; | |||
tasks.forEach(uploadTask => this.clientUpload(uploadTask)); | |||
}); | |||
}, | |||
/** | |||
* 客户端选择文件夹列表并上传 | |||
*/ | |||
async selectSystemFolders() { | |||
if(!this.isClient) return; | |||
const folderPaths = await system.chooseFolders(); | |||
if(!folderPaths) return; | |||
folderPaths.forEach(async fullPath => { | |||
const maybeTasks = await system.analyzeSystemPath(fullPath); | |||
const tasks = maybeTasks || []; | |||
tasks.forEach(uploadTask => this.clientUpload(uploadTask)); | |||
}); | |||
}, | |||
/** | |||
* 客户端上传文件 | |||
* uploadTask: { | |||
* fullPath: 本地完整路径 | |||
* fileName: 文件名 | |||
* extension: 扩展名 | |||
* relativePath: 相对路径 | |||
* } | |||
*/ | |||
clientUpload(uploadTask) { | |||
const { folderName, levelId, id: folderId } = this.currentNodeFolder; | |||
const { folderPath = '' } = this.currentFolder; | |||
const { fullPath: sourceFilePath, fileName, extension: fileExtension, relativePath } = uploadTask; | |||
const params = { | |||
projectId: this.projectId, | |||
projectName: this.projectName, | |||
folderId, folderName, folderLevelId: levelId, distFileRelativePath: `${folderPath ? `${folderPath}\\`:''}${relativePath?`${relativePath}`:''}`.replace(/(\\)+/g, '/'), | |||
fileName, fileExtension, sourceFilePath, | |||
fileList: this.workFileList, | |||
onSuccess: (file) => { // onSuccess | |||
const {ArchName, IpfsCid, Extension, RelativePath} = file; | |||
// 注入到文件下载检测表中 | |||
const key = `${folderName}\\${ArchName}${Extension ? `.${Extension}`: ''}`; | |||
const key = `${folderName}\\${RelativePath ? `${RelativePath.replace(/\//g, '\\')}\\`: ''}${ArchName}${Extension ? `.${Extension}`: ''}`; | |||
this.addLocalFileRecord(key, IpfsCid); | |||
this.removeFileLoadingState(file.Id); | |||
this.fetchFolderFiles(); | |||
}, | |||
(progressData, upperUploadFile) => { // onLoading | |||
onProgress: (progressData, upperUploadFile) => { // onLoading | |||
const { process, hash, size, currentSize, currentUnit, unit } = progressData; | |||
const uploadFile = firstCharToLowerCase(upperUploadFile); | |||
// 避免使用最后一次progreessData中size被修正为Kb的数据 | |||
@@ -784,31 +832,35 @@ export default { | |||
this.uploadFileList.push(uploadFile); | |||
} | |||
}, | |||
(e, upperFile) => { | |||
onError: (e, upperFile) => { | |||
this.removeFileLoadingState(upperFile.Id); | |||
this.uploadFileList = this.uploadFileList.filter(iFile => iFile.id !== upperFile.Id); | |||
} | |||
); | |||
}, | |||
} | |||
// console.log(folderName, levelId, folderId); | |||
system.uploadFile(params); | |||
}, | |||
/** | |||
* 客户端下载方法 | |||
*/ | |||
clientDownLoad: function (file) { | |||
if(!this.isClient) return; | |||
console.log('下载的文件对象', file); | |||
const { ipfsCid, archName: fileName, extension, folderId, nodeName } = file; | |||
// console.log('下载的文件对象', file); | |||
const { ipfsCid, archName: fileName, extension, folderId, nodeName, relativePath } = file; | |||
const folderMap = this.folderMap; | |||
// const { levelId } = folderMap[folderId] || {}; | |||
const nodeFolderName = nodeName || this.currentNodeFolder.folderName; | |||
const extensionedFileName = `${fileName}${extension ? `.${extension}`:''}`; | |||
const isCooperateFile = !!nodeName; | |||
const targetFolderName = `${nodeFolderName}${isCooperateFile ? '\\协作文件': ''}`; | |||
const fileStoreKey = `${targetFolderName}\\${extensionedFileName}`; | |||
const dirName = `${targetFolderName}${relativePath ? `\\${relativePath}`:''}`.replace(/\//g, '\\'); | |||
// const fileStoreKey = `${targetFolderName}\\${extensionedFileName}`; | |||
const fileStoreKey = getFileStoreKey(file, this.currentNodeFolder); | |||
const errorHandler = () => { | |||
this.removeFileLoadingState(file.id); | |||
} | |||
this.updateFileLoadState(file.id, DOWNLOADING, 0); | |||
system.downloadFile(ipfsCid, sessionStorage.projName, extensionedFileName, targetFolderName, (resMessage, socketIns) => { | |||
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 { | |||
@@ -841,24 +893,25 @@ export default { | |||
async commitFile(file) { | |||
if(!this.isClient) return; | |||
const { folderName, levelId, id: folderId } = this.currentNodeFolder; | |||
const { archName, extension, id: fileId } = file; | |||
const { archName, extension, id: fileId, relativePath } = file; | |||
this.updateFileLoadState(fileId, UPLOADING, 0); | |||
const errorHandler = () => { | |||
this.removeFileLoadingState(file.id); | |||
} | |||
// const fileList = this.currentPageType === 0 ? this.folderFileList.listMyFiles : this.folderFileList.listOtherFiles; | |||
const fileKey = `${folderName}\\${archName}${extension ? `.${extension}`:''}`; | |||
// const fileKey = `${folderName}\\${archName}${extension ? `.${extension}`:''}`; | |||
const fileStoreKey = getFileStoreKey(file, this.currentNodeFolder); | |||
system.updateFile( | |||
file, this.localWorkspacePrefix, | |||
this.projectName, folderName, | |||
this.projectName, `${folderName}${relativePath ? `\\${relativePath}`.replace(/\//g, '\\'):''}`, | |||
async (fileNewState) => { | |||
const resFlag = await services.changeFileWorkStatus(file.id, 1); | |||
if(resFlag.Code !== 0) return; | |||
notify.success('文件已更新'); | |||
notify.success(`${file.archName},已更新。`); | |||
const {IpfsCid} = fileNewState; | |||
// 注入到文件下载检测表中 | |||
// 同时更新文件队列中file对象的ipfsCid属性这样才能在下次刷新前使文件的记录保持一致 | |||
this.addLocalFileRecord(fileKey, IpfsCid); | |||
this.addLocalFileRecord(fileStoreKey, IpfsCid); | |||
this.removeFileLoadingState(fileId); | |||
this.workFileList = this.workFileList.map(iFile => iFile.id === file.id ? { ...iFile, ipfsCid: IpfsCid, workStatus: NOT_WORKING } : iFile); | |||
}, | |||
@@ -881,11 +934,12 @@ export default { | |||
const folderName = nodeName || this.currentFolder.folderName; | |||
const localWorkspacePrefix = this.localWorkspacePrefix; | |||
const isCooperationFile = !!nodeName; | |||
const fileStoreKey = `${folderName}${isCooperationFile ? '\\协作文件': ''}\\${archName}${extension ? `.${extension}` : ''}`; | |||
// const fileStoreKey = `${folderName}${isCooperationFile ? '\\协作文件': ''}\\${archName}${extension ? `.${extension}` : ''}`; | |||
const fileStoreKey = getFileStoreKey(file, this.currentNodeFolder); | |||
if(!this.localFileHashMap[fileStoreKey]) return; | |||
const filePath = `${localWorkspacePrefix}\\${fileStoreKey}`; | |||
if(!isCooperationFile && (file.workStatus === 2 && sessionStorage.userId !== file.modifyUserId)) { | |||
notify.warning('文件正在工作编辑中,请耐心等待'); | |||
this.$notify.warning(`${file.modifyName}正在编辑此文件,请在“工作中”标识消失后再尝试打开。`); | |||
return; | |||
} | |||
system.openFile(filePath); | |||
@@ -1009,7 +1063,6 @@ export default { | |||
debugger; | |||
if (file.status == 1 && file.modifyUserID != sessionStorage.userId) { | |||
this.$notify({ | |||
message: "其他人编辑中,不能设置历史文件", | |||
type: "warning", | |||
offset: 100, | |||
@@ -1170,15 +1223,14 @@ export default { | |||
var thisApp = this; | |||
if (createUserId != sessionStorage.userId) { | |||
thisApp.$notify({ | |||
title: "操作提示", | |||
message: "不能删除他人文件", | |||
message: "不能删除他人文件。", | |||
type: "info", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
return; | |||
} | |||
this.$confirm("您正在删除文件【" + archName + "】,是否继续?", "", { | |||
this.$confirm(`确认删除“${archName}”吗?`, "", { | |||
confirmButtonText: "确定", | |||
cancelButtonText: "取消", | |||
// showClose: false, | |||
@@ -1188,7 +1240,7 @@ export default { | |||
if(res.Code === 0) { | |||
thisApp.$notify({ | |||
title: " ", | |||
message: res.Data, | |||
message: `“${archName}”文件已移除。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -176,6 +176,7 @@ | |||
</div> | |||
<div class="ecBtngroup_Item"> | |||
<button | |||
:class="{notclick:!this.multipleSelection[0]}" | |||
type="button" | |||
class="EC_button shadow bt_small_20" | |||
@click="addDept" | |||
@@ -185,6 +186,7 @@ | |||
</div> | |||
<div class="ecBtngroup_Item"> | |||
<button | |||
:class="{notclick:!this.multipleSelection[0]}" | |||
type="button" | |||
class="EC_button shadow bt_small_20" | |||
@click="deleteUsers" | |||
@@ -366,6 +368,7 @@ | |||
<!-- form --> | |||
<el-form | |||
ref="form" | |||
:rules="newUserRules" | |||
:model="currentUser" | |||
label-width="96px" | |||
label-position="left" | |||
@@ -387,7 +390,7 @@ | |||
> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="姓名*"> | |||
<el-form-item label="姓名" prop="cnName"> | |||
<div v-if="eidit == false"> | |||
{{ currentUser.cnName }} | |||
</div> | |||
@@ -401,7 +404,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="*用户头像"> | |||
<el-form-item label="用户头像"> | |||
<div class="large_headImg"> | |||
<img | |||
class="imgHead" | |||
@@ -409,18 +412,6 @@ | |||
/> | |||
</div> | |||
<div class="uploadImg" v-show="eidit == true"> | |||
<!-- <file-Uploader | |||
:mutiple="false" | |||
label="上传头像" | |||
:auto="true" | |||
accept="image" | |||
ref="webUploadlist" | |||
btn-id="filePicker" | |||
:companyId="uploadCompId" | |||
:typeId="uploadTypeHead" | |||
@upload-success="headPicUploadSuccess" | |||
:url="chunkUploadUrl" | |||
></file-Uploader> --> | |||
<file-uploader | |||
:on-success="headPicUploadSuccess" | |||
class="avator-btn" | |||
@@ -433,7 +424,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="*用户名"> | |||
<el-form-item label="用户名" prop="userName"> | |||
<div v-if="eidit == false"> | |||
{{ currentUser.userName }} | |||
</div> | |||
@@ -466,7 +457,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="*平台权限"> | |||
<el-form-item label="平台权限" prop="permission"> | |||
<div v-if="eidit == false" class="eidit_Input"> | |||
{{ currentUser.roleName }} | |||
</div> | |||
@@ -497,7 +488,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="*后台角色"> | |||
<el-form-item label="后台角色" prop="backgroundPermission"> | |||
<div v-if="eidit == false" class="eidit_Input"> | |||
{{ currentUser.backgroundRoleName }} | |||
</div> | |||
@@ -528,7 +519,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="手机*:"> | |||
<el-form-item label="手机:" prop="phone"> | |||
<div v-if="eidit == false"> | |||
{{ currentUser.phone }} | |||
</div> | |||
@@ -765,7 +756,7 @@ | |||
> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="部门*:"> | |||
<el-form-item label="部门:" prop="arraySuper"> | |||
<div v-if="eidit == false"> | |||
{{ currentUser.deptName }} | |||
</div> | |||
@@ -920,6 +911,7 @@ | |||
<el-form | |||
ref="form" | |||
:model="newUser" | |||
:rules="newUserRules" | |||
label-width="90px" | |||
label-position="left" | |||
> | |||
@@ -935,7 +927,7 @@ | |||
> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="姓名*"> | |||
<el-form-item label="姓名:" prop="cnName"> | |||
<div class="eidit_Input"> | |||
<el-input | |||
v-model="newUser.cnName" | |||
@@ -957,18 +949,6 @@ | |||
</div> | |||
</div> | |||
<div class="uploadImg"> | |||
<!-- <file-Uploader | |||
:mutiple="false" | |||
label="上传头像" | |||
:auto="true" | |||
accept="image" | |||
ref="webUploadlist" | |||
btn-id="filePicker" | |||
:companyId="uploadCompId" | |||
:typeId="uploadTypeHead" | |||
@upload-success="headPicUploadSuccess" | |||
:url="chunkUploadUrl" | |||
></file-Uploader> --> | |||
<file-uploader | |||
:on-success="headPicUploadSuccess" | |||
class="avator-btn" | |||
@@ -980,7 +960,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="用户名*"> | |||
<el-form-item label="用户名*:" prop="userName"> | |||
<div class="eidit_Input"> | |||
<el-input | |||
v-model="newUser.userName" | |||
@@ -992,7 +972,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="性别"> | |||
<el-form-item label="性别:"> | |||
<div class="eidit_Input"> | |||
<el-radio-group v-model="newUser.sex"> | |||
<el-radio :label="1">男</el-radio> | |||
@@ -1004,7 +984,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="平台权限*"> | |||
<el-form-item label="平台权限:" prop="permission"> | |||
<div class="eidit_Input"> | |||
<el-select | |||
v-model="newUser.permission" | |||
@@ -1023,7 +1003,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="*后台角色"> | |||
<el-form-item label="后台角色:" prop="backgroundPermission"> | |||
<div class="eidit_Input"> | |||
<el-select | |||
v-model="newUser.backgroundPermission" | |||
@@ -1042,7 +1022,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="手机*:"> | |||
<el-form-item label="手机:" prop="phone"> | |||
<div class="eidit_Input"> | |||
<el-input | |||
v-model="newUser.phone" | |||
@@ -1224,7 +1204,7 @@ | |||
<div class="UserEditinfoBox DivInputHeight noborder"> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="部门*:"> | |||
<el-form-item label="部门:" prop="arraySuper"> | |||
<div class="eidit_Input"> | |||
<el-cascader | |||
:options="deptOptions" | |||
@@ -1341,6 +1321,7 @@ | |||
<!-- form --> | |||
<el-form | |||
ref="form" | |||
:rules="deptRules" | |||
:model="deptData" | |||
label-width="90px" | |||
label-position="left" | |||
@@ -1357,7 +1338,7 @@ | |||
> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="部门名称"> | |||
<el-form-item label="部门名称" prop="deptName"> | |||
<div class="eidit_Input"> | |||
<el-input | |||
v-model="deptData.deptName" | |||
@@ -1418,6 +1399,7 @@ | |||
<!-- form --> | |||
<el-form | |||
ref="form" | |||
:rules="deptRules" | |||
:model="deptData" | |||
label-width="90px" | |||
label-position="left" | |||
@@ -1432,7 +1414,7 @@ | |||
<div class="UserEditinfoBox DivInputHeight noborder"> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="部门名称"> | |||
<el-form-item label="部门名称" prop="deptName"> | |||
<div class="eidit_Input"> | |||
<el-input | |||
v-model="deptData.deptName" | |||
@@ -1568,6 +1550,32 @@ export default { | |||
}, // 新增用户对象 | |||
newUserDeptArry: [], | |||
multipleSelection: [], | |||
deptRules:{ | |||
"deptName":[ | |||
{required: true, message: "请输入部门名称", trigger: "blur"} | |||
], | |||
}, | |||
newUserRules:{ | |||
"cnName":[ | |||
{required: true, message: "请输入姓名", trigger: "blur"} | |||
], | |||
"userName":[ | |||
{required: true, message: "请输入用户名", trigger: "blur"} | |||
], | |||
"permission":[ | |||
{required: true, message: "请选择平台权限", trigger: "blur"} | |||
], | |||
"backgroundPermission":[ | |||
{required: true, message: "请选择后台角色", trigger: "blur"} | |||
], | |||
"phone":[ | |||
{required: true, message: "请输入手机号", trigger: "blur"} | |||
], | |||
"arraySuper":[ | |||
{required: true, message: "请选择部门", trigger: "blur"} | |||
], | |||
}, | |||
pickerOptionsIn: { | |||
disabledDate(time) { | |||
return time.getTime() > Date.now(); | |||
@@ -1822,95 +1830,94 @@ export default { | |||
/** | |||
* 创建部门信息 | |||
*/ | |||
async createDept() { | |||
if (!this.checkDeptData()) { | |||
return; | |||
} | |||
this.addDeptDisable = true; | |||
var thisApp = this; | |||
var array = new Array(); | |||
array = this.deptData.arraySuper; | |||
var levelId = ""; | |||
var superId = ""; | |||
if (array.length > 0) { | |||
for (var i = 0; i < array.length; i++) { | |||
levelId = levelId + array[i]; | |||
if (i < array.length - 1) { | |||
levelId = levelId + "-"; | |||
} else { | |||
superId = array[i]; | |||
createDept() { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
if(!valid) return; | |||
this.addDeptDisable = true; | |||
var thisApp = this; | |||
var array = new Array(); | |||
array = this.deptData.arraySuper; | |||
var levelId = ""; | |||
var superId = ""; | |||
if (array.length > 0) { | |||
for (var i = 0; i < array.length; i++) { | |||
levelId = levelId + array[i]; | |||
if (i < array.length - 1) { | |||
levelId = levelId + "-"; | |||
} else { | |||
superId = array[i]; | |||
} | |||
} | |||
} | |||
} | |||
var parm = { | |||
deptName: this.deptData.deptName, | |||
companyId: sessionStorage.companyId, | |||
remark: "", | |||
// createUserId: sessionStorage.userId || '', | |||
// modifyUserId: sessionStorage.userId || '', | |||
levelId: levelId, | |||
superId: superId, | |||
}; | |||
const res = await services.createDepartment(parm); | |||
const ifSucc = res.Code === 0; | |||
if (!ifSucc) { | |||
this.addDeptDisable = false; | |||
this.$notify.error({ | |||
title: "溫馨提示", | |||
message: res.Msg, | |||
var parm = { | |||
deptName: this.deptData.deptName, | |||
companyId: sessionStorage.companyId, | |||
remark: "", | |||
// createUserId: sessionStorage.userId || '', | |||
// modifyUserId: sessionStorage.userId || '', | |||
levelId: levelId, | |||
superId: superId, | |||
}; | |||
const res = await services.createDepartment(parm); | |||
const ifSucc = res.Code === 0; | |||
if (!ifSucc) { | |||
this.addDeptDisable = false; | |||
this.$notify.error({ | |||
message: res.Msg, | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return; | |||
} | |||
thisApp.addDeptDisable = false; | |||
this.$notify({ | |||
message:`部门“${this.deptData.deptName}”已完成添加。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 5000, | |||
duration: 2500, | |||
}); | |||
return; | |||
} | |||
thisApp.addDeptDisable = false; | |||
this.$notify({ | |||
title: " ", | |||
message: "添加成功", | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
thisApp.listDepts(); | |||
this.currentPain = 1; | |||
this.el_formLabelcolor = "textlabelgray"; | |||
thisApp.listDepts(); | |||
this.currentPain = 1; | |||
this.el_formLabelcolor = "textlabelgray"; | |||
}) | |||
}, | |||
/** | |||
* 更新部门信息 | |||
*/ | |||
async updateDept() { | |||
if (!this.checkDeptData()) { | |||
return; | |||
} | |||
var thisApp = this; | |||
this.deptData.modifyUserId = sessionStorage.userId; | |||
const deptData = this.deptData; | |||
const param = { | |||
Id: deptData.id, | |||
SuperId: deptData.superId, | |||
CompanyId: deptData.companyId, | |||
LevelId: deptData.arraySuper.join("-"), | |||
DeptName: deptData.deptName, | |||
}; | |||
const res = await this.$fetchApi("dept/updateDept", param); | |||
const ifSucc = res.Code === 0; | |||
if (!ifSucc) { | |||
thisApp.$notify.error({ | |||
message: res.Msg, | |||
updateDept() { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
if(!valid) return; | |||
var thisApp = this; | |||
this.deptData.modifyUserId = sessionStorage.userId; | |||
const deptData = this.deptData; | |||
const param = { | |||
Id: deptData.id, | |||
SuperId: deptData.superId, | |||
CompanyId: deptData.companyId, | |||
LevelId: deptData.arraySuper.join("-"), | |||
DeptName: deptData.deptName, | |||
}; | |||
const res = await this.$fetchApi("dept/updateDept", param); | |||
const ifSucc = res.Code === 0; | |||
if (!ifSucc) { | |||
thisApp.$notify.error({ | |||
message: res.Msg, | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
} | |||
thisApp.$notify({ | |||
message: "修改成功。", | |||
type: "success", | |||
offset: 100, | |||
duration: 5000, | |||
duration: 2500, | |||
}); | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: "修改成功", | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
thisApp.listDepts(); | |||
this.currentPain = 1; | |||
thisApp.listDepts(); | |||
this.currentPain = 1; | |||
}) | |||
// // todo | |||
// this.$axios({ | |||
// method: "put", | |||
@@ -1946,9 +1953,8 @@ export default { | |||
*/ | |||
checkDeptData: function () { | |||
if (this.deptData.deptName == null || this.deptData.deptName == "") { | |||
this.$notify({ | |||
message: "请输入部门名称", | |||
this.$notify({ | |||
message: "请输入部门名称。", | |||
type: "warning", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -1961,7 +1967,7 @@ export default { | |||
) { | |||
this.$notify({ | |||
message: "请选择上级部门", | |||
message: "请选择上级部门。", | |||
type: "warning", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -1976,7 +1982,7 @@ export default { | |||
deleteDept: function (data) { | |||
var deptName = data.label; | |||
var thisApp = this; | |||
this.$confirm("删除部门:" + deptName + ", 是否继续?", "", { | |||
this.$confirm(`部门删除后将无法恢复,是否继续删除部门“${deptName}”?`, "", { | |||
confirmButtonText: "确定", | |||
cancelButtonText: "取消", | |||
type: "warning", | |||
@@ -1999,7 +2005,7 @@ export default { | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: "删除成功!", | |||
message:`部门“${deptName}”已删除。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2019,13 +2025,6 @@ export default { | |||
*/ | |||
addDept: function () { | |||
if (this.multipleSelection[0] == null) { | |||
this.$notify({ | |||
message: "请先选择用户", | |||
type: "warning", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
return; | |||
} | |||
this.isDistWorkDeptDialog = true; | |||
@@ -2086,7 +2085,7 @@ export default { | |||
} | |||
this.$notify({ | |||
title: " ", | |||
message: "修改成功", | |||
message: "已完成指派。", | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2101,19 +2100,11 @@ export default { | |||
deleteUsers: function () { | |||
var thisApp = this; | |||
if (thisApp.multipleSelection[0] == null) { | |||
this.$notify({ | |||
message: "请先选择用户", | |||
type: "warning", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
return; | |||
} | |||
if (thisApp.multipleSelection.some((user) => user.default === 1)) { | |||
this.$notify({ | |||
message: "法人账号不能删除", | |||
this.$notify({ | |||
message: "法人账号不能删除。", | |||
type: "warning", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2122,7 +2113,7 @@ export default { | |||
} | |||
var node = thisApp.$refs.tree.getCurrentNode(); | |||
thisApp | |||
.$confirm("用户被删除后将无法恢复,是否继续删除用户操作?", "", { | |||
.$confirm("用户被删除后将无法恢复,是否继续?", "", { | |||
confirmButtonText: "确定", | |||
cancelButtonText: "取消", | |||
type: "warning", | |||
@@ -2151,21 +2142,13 @@ export default { | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: "删除成功", | |||
message: "所选用户删除完成。", | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
this.getUserList(); | |||
// thisApp.nodeClick(node || undefined); | |||
}) | |||
.catch(() => { | |||
this.$notify.info({ | |||
message: "已取消删除", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
}); | |||
}, | |||
@@ -2173,29 +2156,13 @@ export default { | |||
* 创建用户 | |||
* @param {boolean} ifcontinue 是否继续创建 | |||
*/ | |||
async createUser(ifcontinue = false) { | |||
createUser(ifcontinue = false) { | |||
var thisApp = this; | |||
// 验证用户信息 | |||
if (!this.checkUser(this.newUser)) { | |||
return; | |||
} | |||
if ( | |||
this.newUser.arraySuper != null && | |||
this.newUser.arraySuper.length > 0 | |||
) { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
if (!valid) return; | |||
this.newUser.deptid = this.newUser.arraySuper[ | |||
this.newUser.arraySuper.length - 1 | |||
]; | |||
} else { | |||
thisApp.$notify({ | |||
message: "请选择职员所在部门", | |||
type: "warning", | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return; | |||
} | |||
this.newUser.createUserId = sessionStorage.userId; | |||
this.newUser.companyId = sessionStorage.companyId; | |||
const res = await services.addUser(this.newUser); | |||
@@ -2212,7 +2179,7 @@ export default { | |||
// thisApp.newUser = {}; | |||
thisApp.$notify({ | |||
title: " ", | |||
message: "添加成功", | |||
message: `${this.newUser.cnName}添加成功`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2224,83 +2191,7 @@ export default { | |||
if (!ifcontinue) { | |||
this.currentPain = 1; | |||
} | |||
// this.$axios({ | |||
// method: "post", | |||
// url: encodeURI(process.env.API_HOST + "sysinfo/userinfo"), | |||
// data: this.newUser, | |||
// }) | |||
// .then((response) => { | |||
// if (response.data.state == 1) { | |||
// thisApp.newUser = {}; | |||
// thisApp.$notify({ | |||
// title: " ", | |||
// message: response.data.message, | |||
// type: "success", | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
// var node = this.$refs.tree.getCurrentNode(); | |||
// this.newUser = { headImgUrl: "", isDeparture: 0 }; | |||
// // this.listUsers(node.id); | |||
// this.getUserList(node); | |||
// } else { | |||
// thisApp.$notify.error({ | |||
// | |||
// message: response.data.message, | |||
// offset: 100, | |||
// duration: 5000, | |||
// }); | |||
// } | |||
// }) | |||
// .catch((error) => { | |||
// console.log(error); | |||
// }); | |||
}, | |||
/** | |||
* 验证用户信息 | |||
*/ | |||
checkUser: function (user) { | |||
if (user.cnName == undefined || user.cnName == "") { | |||
this.$notify({ | |||
message: "请输入姓名", | |||
offset: 100, | |||
type: "warning", | |||
duration: 5000, | |||
}); | |||
return false; | |||
} | |||
if (user.permission == undefined) { | |||
this.$notify({ | |||
message: "请选择用户平台权限", | |||
type: "warning", | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return false; | |||
} | |||
if (user.backgroundPermission == undefined) { | |||
this.$notify({ | |||
message: "请选择用户后台角色", | |||
type: "warning", | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return false; | |||
} | |||
if (user.phone == undefined || user.phone == "") { | |||
this.$notify({ | |||
message: "请输入手机号", | |||
type: "warning", | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return false; | |||
} | |||
return true; | |||
}); | |||
}, | |||
/** | |||
* 保存用户信息 | |||
@@ -2340,7 +2231,7 @@ export default { | |||
.then((response) => { | |||
if (response.data != null) { | |||
this.$notify({ | |||
title: " ", | |||
message: response.data.message, | |||
type: "success", | |||
offset: 100, | |||
@@ -2499,26 +2390,11 @@ export default { | |||
*/ | |||
async modifyUser() { | |||
var thisApp = this; | |||
if (!this.checkUser(this.currentUser)) { | |||
return; | |||
} | |||
if ( | |||
this.currentUser.arraySuper != null && | |||
this.currentUser.arraySuper.length > 0 | |||
) { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
if(!valid) return; | |||
this.currentUser.deptid = this.currentUser.arraySuper[ | |||
this.currentUser.arraySuper.length - 1 | |||
]; | |||
} else { | |||
this.$notify({ | |||
message: "请选择职员所在部门", | |||
type: "warning", | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return; | |||
} | |||
]; | |||
this.currentUser.modifyUserId = sessionStorage.userId; | |||
const res = await services.updateUser(this.currentUser); | |||
const ifSucc = res.Code === 0; | |||
@@ -2532,8 +2408,7 @@ export default { | |||
return; | |||
} | |||
thisApp.$notify({ | |||
title: "修改成功", | |||
message: "", | |||
message: "修改成功。", | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2541,38 +2416,8 @@ export default { | |||
this.currentPain = 1; | |||
this.editButtonGroup = 1; | |||
// this.listUsers(this.$refs.tree.getCurrentNode().id); | |||
this.getUserList(this.$refs.tree.getCurrentNode()); | |||
// this.$axios({ | |||
// method: "put", | |||
// url: encodeURI(process.env.API_HOST + "sysinfo/userinfo"), | |||
// data: this.currentUser, | |||
// }) | |||
// .then((response) => { | |||
// if (response.data.state == 1) { | |||
// thisApp.$notify({ | |||
// title: " ", | |||
// message: response.data.message, | |||
// type: "success", | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
// this.currentPain = 1; | |||
// this.editButtonGroup = 1; | |||
// // this.listUsers(this.$refs.tree.getCurrentNode().id); | |||
// this.getUserList(this.$refs.tree.getCurrentNode()); | |||
// } else { | |||
// thisApp.$notify.error({ | |||
// | |||
// message: response.data.message, | |||
// offset: 100, | |||
// duration: 5000, | |||
// }); | |||
// } | |||
// }) | |||
// .catch((error) => { | |||
// console.log(error); | |||
// }); | |||
this.getUserList(this.$refs.tree.getCurrentNode()); | |||
}); | |||
}, | |||
/** | |||
* 禁用用户 | |||
@@ -2585,8 +2430,7 @@ export default { | |||
} else { | |||
actionText = "禁用"; | |||
} | |||
this.$confirm( | |||
actionText + "用户:" + this.currentUser.cnName + ",是否继续?", | |||
this.$confirm(`${actionText}的用户将${actionText == "禁用" ? "无法" : "有权"}访问我司LOCKING,确定${actionText}“${this.currentUser.cnName}”的账户吗?`, | |||
"", | |||
{ | |||
confirmButtonText: "确定", | |||
@@ -2606,7 +2450,7 @@ export default { | |||
if (response.data.state == 1) { | |||
thisApp.$notify({ | |||
title: " ", | |||
message: actionText + "成功", | |||
message: `${this.currentUser.cnName}已${actionText}`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -2625,12 +2469,12 @@ export default { | |||
}); | |||
}) | |||
.catch(() => { | |||
thisApp.$notify.info({ | |||
// thisApp.$notify.info({ | |||
message: "已取消" + actionText, | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
// message: "已取消" + actionText, | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
}); | |||
}, | |||
/** | |||
@@ -2639,9 +2483,7 @@ export default { | |||
deleteUserInfo: function () { | |||
var thisApp = this; | |||
this.$confirm( | |||
"用户被删除后将无法恢复,是否继续删除用户:" + | |||
this.currentUser.cnName + | |||
" ?", | |||
`账户删除后将无法恢复,是否继续删除“${this.currentUser.cnName}”的账户?`, | |||
"", | |||
{ | |||
confirmButtonText: "确定", | |||
@@ -2703,12 +2545,12 @@ export default { | |||
// }); | |||
}) | |||
.catch(() => { | |||
this.$notify.info({ | |||
// this.$notify.info({ | |||
message: "已取消删除", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
// message: "已取消删除", | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
}); | |||
}, | |||
/** | |||
@@ -2801,6 +2643,10 @@ export default { | |||
</script> | |||
<style lang="scss" scoped> | |||
.notclick{ | |||
cursor:not-allowed; | |||
opacity: 0.8; | |||
} | |||
.avator-btn { | |||
line-height: 50px; | |||
@@ -209,6 +209,7 @@ | |||
<el-form | |||
ref="form" | |||
:model="currentCompany" | |||
:rules="companyRules" | |||
label-width="100px" | |||
label-position="right" | |||
> | |||
@@ -222,7 +223,7 @@ | |||
<div :class="el_formLabelcolor +' UserEditinfoBox DivInputHeight'"> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="企业简称:" :required="boolEdit"> | |||
<el-form-item label="企业简称:" prop="companyName"> | |||
<div v-if="boolEdit == false">{{currentCompany.companyName}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.companyName"></el-input> | |||
@@ -233,7 +234,7 @@ | |||
<!-- 2019-07-31 新加的 --> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="企业全称:" :required="boolEdit"> | |||
<el-form-item label="企业全称:" prop="compAllName"> | |||
<div v-if="boolEdit == false">{{currentCompany.compAllName}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.compAllName"></el-input> | |||
@@ -253,7 +254,7 @@ | |||
</div>--> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="所属省份:" :required="boolEdit"> | |||
<el-form-item label="所属省份:" prop="proviceName" > | |||
<div v-if="boolEdit == false">{{currentCompany.proviceName}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-select v-model="currentCompany.proviceID" placeholder="请选择"> | |||
@@ -280,7 +281,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="所属行业:" :required="boolEdit"> | |||
<el-form-item label="所属行业:" prop="industryName" > | |||
<div v-if="boolEdit == false">{{currentCompany.industryName}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-select v-model="currentCompany.industryID" placeholder="请选择"> | |||
@@ -297,7 +298,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="单位电话:" :required="boolEdit"> | |||
<el-form-item label="单位电话:" prop="telphone" > | |||
<div v-if="boolEdit == false">{{currentCompany.telphone}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.telphone"></el-input> | |||
@@ -307,7 +308,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="法人:" :required="boolEdit"> | |||
<el-form-item label="法人:" prop="cnName" > | |||
<div v-if="boolEdit == false">{{currentCompany.cnName}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.cnName"></el-input> | |||
@@ -317,7 +318,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="性别:" :required="boolEdit"> | |||
<el-form-item label="性别:" prop="sex" > | |||
<div v-if="boolEdit==false"> | |||
<div v-if="currentCompany.sex==1">帅哥</div> | |||
<div v-if="currentCompany.sex==0">美女</div> | |||
@@ -333,7 +334,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="手机号:" :required="boolEdit"> | |||
<el-form-item label="手机号:" prop="phone" > | |||
<div v-if="boolEdit == false">{{currentCompany.phone}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.phone" :disabled="!!currentCompany.companyID"></el-input> | |||
@@ -343,7 +344,7 @@ | |||
</div> | |||
<div class="yiyun_col-6"> | |||
<div class="el-form-itemBox"> | |||
<el-form-item label="邮箱:" :required="boolEdit"> | |||
<el-form-item label="邮箱:" prop="email" > | |||
<div v-if="boolEdit == false">{{currentCompany.email}}</div> | |||
<div v-if="boolEdit == true" class="boolEdit_Input"> | |||
<el-input v-model="currentCompany.email"></el-input> | |||
@@ -863,6 +864,36 @@ export default { | |||
el_formLabelcolor: "textlabelgray", //textlabelgray表单label为灰色字 textlabelblock 表单label为黑色字 | |||
// 树 | |||
listCompanyData: [], | |||
companyRules:{ | |||
"companyName":[ | |||
{ required: true, message: "请输入企业简称", trigger: "blur" }, | |||
], | |||
"compAllName": [ | |||
{ required: true, message: "请输入企业全称", trigger: "blur" }, | |||
], | |||
"proviceName": [ | |||
// { type:'number', required: true, message: "请选择所属省份", trigger:'change' }, | |||
{ required: true, message: "请选择所属省份", trigger:'change' }, | |||
], | |||
"industryName": [ | |||
{ required: true, message: "请选择所属行业", trigger:'change' }, | |||
], | |||
"telphone": [ | |||
{ required: true, message: "请输入单位电话", trigger: "blur" }, | |||
], | |||
"cnName": [ | |||
{ required: true, message: "请输入法人", trigger: "blur" }, | |||
], | |||
"sex": [ | |||
{ required: true, message: "请选择性别", trigger: 'change' }, | |||
], | |||
"phone": [ | |||
{ required: true, message: "请输入手机号", trigger: "blur" }, | |||
], | |||
"email": [ | |||
{ required: true, message: "请输入邮箱", trigger: "blur" }, | |||
], | |||
}, | |||
industryOptions: [ | |||
{ | |||
value: "建筑行业", | |||
@@ -980,6 +1011,7 @@ export default { | |||
}, | |||
], | |||
CompanyInfo: "", // 企业总体信息 | |||
initCompanyRecord:{},//记录原始的公司信息 | |||
}; | |||
}, | |||
//生命周期 | |||
@@ -989,6 +1021,14 @@ export default { | |||
this.loadIndustury(); | |||
this.loadProvinces(); | |||
}, | |||
computed: { | |||
selectedIndustyId() { | |||
return this.currentCompany.industryID; | |||
}, | |||
selectProvinceId() { | |||
return this.currentCompany.proviceID; | |||
} | |||
}, | |||
//方法 | |||
methods: { | |||
async loadProvinces() { | |||
@@ -1024,6 +1064,7 @@ export default { | |||
var thisApp = this; | |||
const resData = await services.fetchCompanyDetail(companyid); | |||
this.currentCompany = resData; | |||
this.initCompanyRecord = {...resData}; | |||
// this.$axios({ | |||
// method: "get", | |||
// url: encodeURI( | |||
@@ -1122,53 +1163,35 @@ export default { | |||
/** | |||
* 更新企业信息 | |||
*/ | |||
async updateCompany() { | |||
if (!this.checkCompanyData()) { | |||
return false; | |||
} | |||
var thisApp = this; | |||
this.currentCompany.modifyUserID = sessionStorage.userId; | |||
const res = await services.updateCompany(this.currentCompany); | |||
const flag = res.Code === 0; | |||
if (!flag) { | |||
return false; | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: '修改成功', | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
updateSave() { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
console.log('valid', valid); | |||
if(!valid) return; | |||
var thisApp = this; | |||
this.currentCompany.modifyUserID = sessionStorage.userId; | |||
const res = await services.updateCompany(this.currentCompany); | |||
const flag = res.Code === 0; | |||
if (!flag) { | |||
return; | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: `企业“${this.currentCompany.companyName}”已完成修改。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
thisApp.listCompany(); | |||
this.initCompanyRecord = {...this.currentCompany};//保存之后信息得同步 否则取消的时候回出问题 | |||
this.el_formLabelcolor = "textlabelgray"; | |||
this.editButtonGroup = 1; | |||
this.boolEdit = false; | |||
this.rightTitle = this.currentCompany.companyName; | |||
}); | |||
thisApp.listCompany(); | |||
return true; | |||
// this.$axios({ | |||
// method: "put", | |||
// url: encodeURI(process.env.API_HOST + "sysinfo/company"), | |||
// data: this.currentCompany, | |||
// }) | |||
// .then((response) => { | |||
// if (response.data.state == 1) { | |||
// thisApp.$notify({ | |||
// title: " ", | |||
// message: response.data.message, | |||
// type: "success", | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
// thisApp.listCompany(); | |||
// } else { | |||
// thisApp.$notify.error({ | |||
// | |||
// message: response.data.message, | |||
// offset: 100, | |||
// duration: 5000, | |||
// }); | |||
// } | |||
// }) | |||
// .catch((error) => { | |||
// console.log(error); | |||
// }); | |||
}, | |||
/** | |||
* 验证企业信息表单数据 | |||
@@ -1317,12 +1340,7 @@ export default { | |||
} else { | |||
actionText = "禁用"; | |||
} | |||
this.$confirm( | |||
actionText + | |||
"企业:" + | |||
this.currentCompany.companyName + | |||
", 是否继续?", | |||
"", | |||
this.$confirm(`${actionText}的企业将${actionText == "禁用" ? "无法" : "有权"}访问LOCKING, 确定${actionText}企业“${this.currentCompany.companyName}”吗?`,"", | |||
{ | |||
confirmButtonText: "确定", | |||
cancelButtonText: "取消", | |||
@@ -1348,19 +1366,19 @@ export default { | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: actionText + "成功", | |||
message: `企业“${this.currentCompany.companyName}”已${actionText}。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
}) | |||
.catch(() => { | |||
thisApp.$notify.info({ | |||
// thisApp.$notify.info({ | |||
message: "已取消" + actionText, | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
// message: "已取消" + actionText, | |||
// offset: 100, | |||
// duration: 2500, | |||
// }); | |||
}); | |||
}, | |||
/** | |||
@@ -1368,8 +1386,7 @@ export default { | |||
*/ | |||
deleteCompanyClick: function () { | |||
var thisApp = this; | |||
this.$confirm( | |||
"删除企业:" + this.currentCompany.companyName + ", 是否继续?", | |||
this.$confirm(`确定删除企业“${this.currentCompany.companyName}”吗?`, | |||
"", | |||
{ | |||
confirmButtonText: "确定", | |||
@@ -1387,7 +1404,7 @@ export default { | |||
thisApp.currentPain = 1; | |||
thisApp.$notify({ | |||
title: " ", | |||
message: "删除成功", | |||
message: `企业“${this.currentCompany.companyName}”已删除。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
@@ -1403,29 +1420,25 @@ export default { | |||
} | |||
}) | |||
.catch(() => { | |||
thisApp.$notify.info({ | |||
message: "已取消删除", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
}); | |||
}, | |||
/** | |||
* 更新企业信息,保存数据 | |||
*/ | |||
async updateSave () { | |||
const flag = await this.updateCompany(); | |||
if(!flag) return; | |||
this.el_formLabelcolor = "textlabelgray"; | |||
this.editButtonGroup = 1; | |||
this.boolEdit = false; | |||
this.rightTitle = this.currentCompany.companyName; | |||
}, | |||
// async updateSave () { | |||
// const flag = this.updateCompany(); | |||
// console.log(flag); | |||
// if(!flag) return; | |||
// this.el_formLabelcolor = "textlabelgray"; | |||
// this.editButtonGroup = 1; | |||
// this.boolEdit = false; | |||
// this.rightTitle = this.currentCompany.companyName; | |||
// }, | |||
/** | |||
* 取消更新企业信息 | |||
*/ | |||
updateCancel: function () { | |||
this.currentCompany = {...this.initCompanyRecord}; | |||
this.boolEdit = false; | |||
this.editButtonGroup = 1; | |||
this.rightTitle = this.currentCompany.companyName; | |||
@@ -1483,35 +1496,37 @@ export default { | |||
/** | |||
* 新建企业,保存数据 | |||
*/ | |||
async addSave() { | |||
if (!this.checkCompanyData()) { | |||
return; | |||
} | |||
var thisApp = this; | |||
this.currentCompany.createUserID = sessionStorage.userId; | |||
this.currentCompany.modifyUserID = sessionStorage.userId; | |||
const res = await services.createCompany(this.currentCompany); | |||
const isSuccess = res.Code === 0; | |||
if (!isSuccess) { | |||
thisApp.$notify.error({ | |||
message: res.Msg, | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return; | |||
} | |||
thisApp.$notify({ | |||
title: " ", | |||
message: res.Msg, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
addSave() { | |||
this.$refs['form'].validate(async (valid)=>{ | |||
if(!valid) return; | |||
var thisApp = this; | |||
this.currentCompany.createUserID = sessionStorage.userId; | |||
this.currentCompany.modifyUserID = sessionStorage.userId; | |||
const res = await services.createCompany(this.currentCompany); | |||
const isSuccess = res.Code === 0; | |||
if (!isSuccess) { | |||
thisApp.$notify.error({ | |||
message: res.Msg, | |||
offset: 100, | |||
duration: 5000, | |||
}); | |||
return; | |||
} | |||
thisApp.$notify({ | |||
message: `企业“${this.currentCompany.companyName}”已完成添加。`, | |||
type: "success", | |||
offset: 100, | |||
duration: 2500, | |||
}); | |||
this.currentPain = 1; | |||
this.el_formLabelcolor = "textlabelgray"; | |||
this.boolEdit = false; | |||
this.listCompany(); | |||
}); | |||
this.currentPain = 1; | |||
this.el_formLabelcolor = "textlabelgray"; | |||
this.boolEdit = false; | |||
this.listCompany(); | |||
}, | |||
/* | |||
* 筛选符合条件的tree节点 | |||
@@ -1590,6 +1605,19 @@ export default { | |||
filterTreeText(val) { | |||
this.$refs.tree.filter(val); | |||
}, | |||
}, | |||
// 当选择的所属行业的Id发生变化的时候 及时更新选择行业的名字 | |||
selectedIndustyId(val) { | |||
let target = this.industryOptions.find(industry => industry.industryID === this.currentCompany.industryID); | |||
if(target) { | |||
this.currentCompany.industryName = target.name; | |||
} | |||
}, | |||
selectProvinceId() { | |||
let target = this.proviceOptions.find(p => p.id === this.currentCompany.proviceID); | |||
if(target) { | |||
this.currentCompany.proviceName = target.label; | |||
} | |||
} | |||
} | |||
}; | |||
</script> |
@@ -144,7 +144,7 @@ export async function updateCompany(data) { | |||
} | |||
const resData = await fetchApi('company/updateCompanyById', { company: fixedData, user: userData }); | |||
return wrapErrorHint(resData); | |||
return (resData); | |||
} | |||
async function recursionFetchNode(parentNodeId, topNodeId) { | |||
@@ -2272,7 +2272,7 @@ export default { | |||
// todo 自定义自定去重 | |||
// if(listProperty) | |||
if (!isEdit && (!data.Node || data.Node.length === 0)) { | |||
notify.error("xmind文件尚未上传"); | |||
notify.error("Xmind文件尚未上传。"); | |||
return; | |||
} | |||
if (isEdit) { | |||
@@ -2294,7 +2294,7 @@ export default { | |||
// notify.error(res.Msg || `${keyword}失败`); | |||
return; | |||
} | |||
notify.success(`模板${keyword}成功`); | |||
notify.success(`模板${keyword}完成。`); | |||
if (!isEdit) { | |||
thisApp.isShowModelpanel = false; | |||
thisApp.isShowLookIndustryInfo = true; | |||
@@ -3022,10 +3022,11 @@ export default { | |||
}, | |||
onUploadSuccess({ response: res }) { | |||
if (res.Code !== 0) { | |||
notify.error(`xmind文件解析失败,${res.Msg}`); | |||
// notify.error(`xmind文件解析失败,${res.Msg}`); | |||
notify.error('请上传正确的Xmind文件。'); | |||
return; | |||
} | |||
notify.success("xmind文件解析成功"); | |||
notify.success("Xmind文件解析成功。"); | |||
this.editTemplateData.Node = res.Data; | |||
this.isXimdUpLoadSuccess = true; | |||
}, | |||
@@ -3176,7 +3177,7 @@ export default { | |||
cacelInsertTemplate: function () { | |||
this.$confirm( | |||
"取消操作会清除当前所填写的模板信息,是否确认取消?", | |||
"取消新增模板", | |||
"", | |||
{ | |||
confirmButtonText: "确定", | |||
cancelButtonText: "返回", | |||