| | |
| | | <!-- |
| | | * @Date: 2024-05-22 23:37:07 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-05-26 15:42:35 |
| | | * @LastEditTime: 2024-06-05 22:52:06 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/station-file/File.vue |
| | | --> |
| | | <template> |
| | | <el-container> |
| | | <el-header> |
| | | <el-button type="primary">归档</el-button> |
| | | <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>程序</h2> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-table-column label="文件名称" prop="" width=""></el-table-column> |
| | | <el-table-column label="版本" prop="" width=""></el-table-column> |
| | | <el-table-column label="大小" prop="" width=""></el-table-column> |
| | | <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>文件</h2> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-table-column label="文件名称" prop="" width=""></el-table-column> |
| | | <el-table-column label="版本" prop="" width=""></el-table-column> |
| | | <el-table-column label="大小" prop="" width=""></el-table-column> |
| | | <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 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 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> |
| | | |