From 2b0722ca2665708f7b35cf627a6aa20f3af32082 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期三, 09 十月 2024 20:30:12 +0800 Subject: [PATCH] update --- src/views/dnc/station-file/File.vue | 268 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 264 insertions(+), 4 deletions(-) diff --git a/src/views/dnc/station-file/File.vue b/src/views/dnc/station-file/File.vue index b5e3240..924696c 100644 --- a/src/views/dnc/station-file/File.vue +++ b/src/views/dnc/station-file/File.vue @@ -1,18 +1,278 @@ <!-- * @Date: 2024-05-22 23:37:07 * @LastEditors: Sneed - * @LastEditTime: 2024-05-22 23:37:12 + * @LastEditTime: 2024-06-16 16:19:33 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/station-file/File.vue --> <template> - <div> - 宸ヤ綅鏂囦欢 - </div> + <el-container> + <el-header> + <el-button :disabled="selectionFile.length == 0 && selection.length == 0" type="primary" + @click="archive">褰掓。</el-button> + <el-tree-select v-model="storageSpaceId" :data="treeData" :props="{ + label: 'name', + }" node-key="id" default-expand-all check-strictly style="width: 240px"> + <template #prefix> + FTP鐩綍 + </template> + </el-tree-select> + </el-header> + <el-main> + <h2 style="background-color: var(--el-color-primary);color: #fff;padding: 4px 20px;">绋嬪簭</h2> + <el-table :data="tableData" style="width: 100%" @selection-change="onSelectionChange"> + <el-table-column type="selection"></el-table-column> + <el-table-column label="鏂囦欢鍚嶇О" prop="filename" width=""></el-table-column> + <el-table-column label="鐗堟湰" prop="versionDesc" width=""></el-table-column> + <el-table-column label="澶у皬" prop="contentLength" width=""></el-table-column> + <el-table-column label="鏂囦欢绫诲瀷" prop="suffix" width=""></el-table-column> + <el-table-column label="鏂囦欢浣嶇疆" prop="fileLocation" width=""></el-table-column> + <el-table-column label="褰掓。鐘舵��" prop="whetherArchiveDesc" width=""></el-table-column> + <el-table-column label="鏇存柊浜�" prop="updateUserName" width=""></el-table-column> + <el-table-column label="鏇存柊鏃堕棿" prop="updateTime" width=""></el-table-column> + <el-table-column label="鎿嶄綔" prop="" width=""> + <template #default="scope"> + <el-button-group> + <el-button text type="primary" size="small" + @click="download(scope.row, scope.$index)">涓嬭浇</el-button> + <el-popconfirm width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="table_del(scope.row)"> + <template #reference> + <el-button text type="primary" size="small">鍒犻櫎</el-button> + </template> + </el-popconfirm> + </el-button-group> + </template> + </el-table-column> + </el-table> + <h2 style="margin-top: 10px;background-color: var(--el-color-primary);color: #fff;padding: 4px 20px;">鏂囦欢 + </h2> + <el-table :data="tableDataFile" style="width: 100%" @selection-change="onSelectionChangeFile"> + <el-table-column type="selection"></el-table-column> + <el-table-column label="鏂囦欢鍚嶇О" prop="filename" width=""></el-table-column> + <el-table-column label="鐗堟湰" prop="versionDesc" width=""></el-table-column> + <el-table-column label="澶у皬" prop="contentLength" width=""></el-table-column> + <el-table-column label="鏂囦欢绫诲瀷" prop="suffix" width=""></el-table-column> + <el-table-column label="鏂囦欢浣嶇疆" prop="fileLocation" width=""></el-table-column> + <el-table-column label="褰掓。鐘舵��" prop="whetherArchiveDesc" width=""></el-table-column> + <el-table-column label="鏇存柊浜�" prop="updateUserName" width=""></el-table-column> + <el-table-column label="鏇存柊鏃堕棿" prop="updateTime" width=""></el-table-column> + <el-table-column label="鎿嶄綔" prop="" width=""> + <template #default="scope"> + <el-button-group> + <el-button text type="primary" size="small" + @click="download(scope.row, scope.$index)">涓嬭浇</el-button> + <el-popconfirm width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="table_del(scope.row)"> + <template #reference> + <el-button text type="primary" size="small">鍒犻櫎</el-button> + </template> + </el-popconfirm> + </el-button-group> + </template> + </el-table-column> + </el-table> + </el-main> + <scDialog v-model="visible"> + <el-tabs v-model="activeName" type="card" class="demo-tabs"> + <el-tab-pane label="褰掓。鐩綍" name="1"> + <el-tree :expand-on-click-node="false" v-if="activeName === '1'" ref="group" node-key="id" :props="{ + label: 'name', + hasChildren: 'id' + }" show-checkbox :load="loadNode" lazy></el-tree> + </el-tab-pane> + <el-tab-pane label="宸ヨ壓绠$悊" name="2"> + <el-tree :expand-on-click-node="false" v-if="activeName === '2'" ref="group" node-key="id" :props="{ + label: 'name', + hasChildren: 'id' + }" show-checkbox :load="loadNode1" lazy></el-tree> + </el-tab-pane> + </el-tabs> + <template #footer> + <div style="text-align: right;"> + <el-button type="primary" @click="confirm">纭畾</el-button> + </div> + </template> + + </scDialog> + </el-container> </template> <script> export default { + props: { + treeChecked: { + type: Array, + } + }, + watch: { + treeChecked(val) { + console.log(val[0]) + if (val?.[0]) { + this.init(val?.[0]) + } else { + this.treeData = [] + } + }, + storageSpaceId() { + this.getFilelist() + } + }, + data() { + return { + treeData: [], + storageSpaceId: '', + tableData: [], + tableDataFile: [], + selection: [], + selectionFile: [], + visible: false, + activeName: '1' + } + }, + methods: { + init(workstationId) { + this.$HTTP.get(`/api/blade-dnc/dnc-fixed-space/direct-loading-space-tree?workstationId=${workstationId}`).then(res => { + this.storageSpaceId = res.data[0].id + this.treeData = this.formatData(res.data) + }) + }, + formatData(data, current, flag) { + let newData = [] + if (!current) { + newData = data.filter(item => item.parentId == 0).map(v => { + v.children = this.formatData(data, v, flag).sort((a, b) => { + return b.sort - a.sort + }) + flag && (v.disabled = !v.isWorkstation) + return v + }) + } else { + let res = data.filter(v => v.parentId == current.id) + res = res.map(item => { + item.children = this.formatData(data, item, flag).sort((a, b) => { + return b.sort - a.sort + }) + flag && (item.disabled = !item.isWorkstation) + return item + }) + return res + } + return newData + }, + getFilelist() { + this.$HTTP.post(`/api/blade-dnc/transfer-directory/fileList`, { + storageSpaceId: this.storageSpaceId, + fileLocations: [2], + workstationId: this.treeChecked[0] + }).then(res => { + this.selection = [] + this.tableData = res.data.filter(v => v.fileType == 1) + this.tableDataFile = res.data.filter(v => v.fileType == 2) + }) + }, + onSelectionChange(selection) { + this.selection = selection + }, + onSelectionChangeFile(selection) { + this.selectionFile = selection + }, + download() { + }, + table_del(row) { + this.$HTTP.get(`/api/blade-dnc/transfer-directory/delete-file/${row.id}`).then(res => { + this.getFilelist() + }) + }, + loadNode(node, resolve) { + let id = node.level === 0 ? '' : node.data.id + this.$HTTP.get(`/api/blade-dnc/dnc-archive-directory/list?parentId=${id}`).then(res => { + resolve(res.data) + }) + }, + loadNode1(node, resolve) { + let id = node.level === 0 ? '' : node.data.id + this.$HTTP.get(`/api/blade-dnc/dnc-process-catalogue/lazy-art-list?parentId=${id}`).then(res => { + resolve(res.data) + }) + }, + archive() { + this.visible = true + }, + async confirm() { + let archiveDirectoryIds = this.$refs.group.getCheckedNodes().map(v => v.id) + console.log('>>>>>>', archiveDirectoryIds) + if (archiveDirectoryIds.length === 0) { + return this.$message.warning(`璇烽�夋嫨鏂囦欢澶筦); + } + if (this.activeName === '1') { + this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/checkFile`, { + archiveDirectoryIds, + voList: [...this.selection, ...this.selectionFile].map(v => { + return { + contentMd5: v.contentMd5, + filename: v.filename, + objectKey: v.objectKey, + workstationId: v.workstationId + } + }) + }).then(res => { + if (!res.data) { + this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/insert`, { + archiveDirectoryIds, + fileAddVOList: [...this.selection, ...this.selectionFile].map(v => { + return { + contentLength: v.contentLength, + contentMd5: v.contentMd5, + contentType: v.contentType, + fileOwnership: v.documentOwnerships || 1, + filename: v.filename, + link: v.link, + objectKey: v.objectKey, + originalFilename: v.originalFilename, + suffix: v.suffix, + workstationFileId: v.id, + workstationId: v.workstationId, + } + }) + }).then(res => { + this.visible = false + this.$message.success(res.msg); + }) + } + }) + } else { + Promise.all(archiveDirectoryIds.map(v => { + return this.$HTTP.post(`/api/blade-dnc/dnc-art-file/duplicate-validation-file`, { + artBagId: v, + artFileAddVOList: [...this.selection, ...this.selectionFile].map(v => { + return { + contentMd5: v.contentMd5, + fileType: v.fileType, + filename: v.filename, + objectKey: v.objectKey, + } + }) + }) + })).then(arr => { + let artBagIds = [] + arr.forEach((item, index) => { + if (!item.data) artBagIds.push(archiveDirectoryIds[index]) + }); + if (artBagIds.length === 0) { + return this.$message.warning(`閲嶅`); + } + this.$HTTP.post(`/api/blade-dnc/dnc-art-file/batch-insert`, { + artBagIds, + dncArtFileAddList: [...this.selection, ...this.selectionFile] + }).then(res => { + this.visible = false + this.$message.success(res.msg); + }) + }) + } + + // /api/blade-dnc/dnc-archive-directory-file/checkFile + } + }, } </script> -- Gitblit v1.9.3