| | |
| | | <!-- |
| | | * @Date: 2024-05-26 21:59:53 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-05-26 22:11:25 |
| | | * @LastEditTime: 2024-06-13 23:17:58 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/transport/index.vue |
| | | --> |
| | | <template> |
| | |
| | | <el-col :span="8" :gutter="20"> |
| | | <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tab-pane label="我的文档" name="1"> |
| | | |
| | | <el-tree default-expand-all ref="tree" node-key="id" :data="treeData" :props="{ |
| | | label: 'name', |
| | | }" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id"> |
| | | <template #default="{ node, data }"> |
| | | <span :class="data.isGroup ? 'active' : ''" class="custom-tree-node"> |
| | | <span>{{ |
| | | node.label || data.code }}</span> |
| | | </span> |
| | | </template> |
| | | </el-tree> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="工艺管理" name="2"> |
| | | |
| | | <el-tree default-expand-all ref="tree" node-key="id" :data="treeData1" :props="{ |
| | | label: (data, node) => { |
| | | return data.name || data.artName |
| | | }, |
| | | }" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id"> |
| | | <template #default="{ node, data }"> |
| | | <span :class="data.isGroup ? 'active' : ''" class="custom-tree-node"> |
| | | <span>{{ |
| | | node.label || data.code }}</span> |
| | | </span> |
| | | </template> |
| | | </el-tree> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </el-col> |
| | | <el-col :span="16"> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-table :data="tableData" style="width: 100%" @selection-change="onSelectionChange"> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <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> |
| | | <el-table-column label="文件类型" prop="" width=""></el-table-column> |
| | | <el-table-column label="更新时间" prop="" width=""></el-table-column> |
| | | <el-table-column label="文件名称" prop="filename" width=""> |
| | | <template #default="scope"> |
| | | {{ scope.row.filename || scope.row.name }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="源路径" prop="sourcePath" width=""> |
| | | <template #default="scope"> |
| | | {{ scope.row.sourcePath || scope.row.allPathName }} |
| | | </template> |
| | | </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="updateTime" width=""></el-table-column> |
| | | </el-table> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <div class="main-container-item"> |
| | | <el-row> |
| | | <el-col :span="8" :gutter="20"> |
| | | <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tabs v-model="activeName1" type="card" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tab-pane label="以太网" name="1"> |
| | | |
| | | <MYTree v-model="treeChecked"></MYTree> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="内部存储" name="2"> |
| | | |
| | |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <h3>程序</h3> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-button type="primary" @click="copy">传输至当前目标</el-button> |
| | | <!-- <el-button type="primary" @click="copy1">上传至上方路径</el-button> --> |
| | | <el-table :data="list1" style="width: 100%"> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <el-table-column label="文件名称" prop="" width=""></el-table-column> |
| | | <el-table-column label="存储空间" prop="" width=""></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="fixSpaceLocation" width=""></el-table-column> |
| | | <el-table-column label="大小" prop="contentLength" width=""></el-table-column> |
| | | </el-table> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <h3>文件</h3> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-button type="primary" @click="copy3">传输至当前目标</el-button> |
| | | <!-- <el-button type="primary">上传至上方路径</el-button> --> |
| | | <el-table :data="list2" style="width: 100%"> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <el-table-column label="文件名称" prop="" width=""></el-table-column> |
| | | <el-table-column label="存储空间" prop="" width=""></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="fixSpaceLocation" width=""></el-table-column> |
| | | <el-table-column label="大小" prop="contentLength" width=""></el-table-column> |
| | | </el-table> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | <scDialog v-model="visible"> |
| | | <scForm ref="form" :config="config" :rules="rules" v-model="form" @submit="submit"> |
| | | </scForm> |
| | | </scDialog> |
| | | </el-main> |
| | | </template> |
| | | |
| | | <script> |
| | | import MYTree from '@/views/mdc/MYTree.vue' |
| | | export default { |
| | | components: { |
| | | MYTree, |
| | | }, |
| | | computed: { |
| | | list1() { |
| | | return this.list.filter(v => v.fileType == 1) |
| | | }, |
| | | list2() { |
| | | return this.list.filter(v => v.fileType == 2) |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | activeName: '1', |
| | | activeName1: '1', |
| | | selectNode: {}, |
| | | treeData: [], |
| | | treeData1: [], |
| | | tableData: [], |
| | | treeChecked: {}, |
| | | list: [], |
| | | workTreeData: [], |
| | | config: { |
| | | labelWidth: 120, |
| | | formItems: [ |
| | | { |
| | | component: 'el-tree-select', |
| | | label: '文件位置', |
| | | name: 'storageSpaceId', |
| | | options: { |
| | | multiple: false, |
| | | data: [], |
| | | hidecheckbox: true, |
| | | props: { |
| | | label: 'name' |
| | | }, |
| | | checkStrictly: true |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | visible: false, |
| | | form: {}, |
| | | rules: { |
| | | name: [ |
| | | { required: true, message: '请输入姓名' } |
| | | ] |
| | | }, |
| | | selection: [], |
| | | fileType: 1, |
| | | } |
| | | }, |
| | | watch: { |
| | | activeName() { |
| | | this.selectNode = {} |
| | | this.selection = [] |
| | | }, |
| | | 'selectNode.id'(val) { |
| | | console.log(val, '>>>>>>>') |
| | | if (val !== undefined && val !== '') |
| | | if (this.activeName === '1') { |
| | | this.$HTTP.get(`/api/blade-dnc/folder?parent=${val}`).then(res => { |
| | | if (res.success) { |
| | | this.tableData = res.data.fileList |
| | | } else { |
| | | this.tableData = [] |
| | | } |
| | | }).catch(err => { |
| | | this.tableData = [] |
| | | }) |
| | | } else { |
| | | this.$HTTP.get(`/api/blade-dnc/dnc-art-file/list?artBagId=${val}`).then(res => { |
| | | if (res.success) { |
| | | this.tableData = res.data |
| | | } else { |
| | | this.tableData = [] |
| | | } |
| | | }).catch(err => { |
| | | this.tableData = [] |
| | | }) |
| | | } |
| | | }, |
| | | treeChecked(val) { |
| | | if (val?.length > 0) { |
| | | this.getFileList(val?.[0]) |
| | | this.$HTTP.get(`/api/blade-dnc/dnc-fixed-space/direct-loading-space-tree?workstationId=${val?.[0]}`).then(res => { |
| | | if (res.success) { |
| | | this.workTreeData = this.formatData(res.data) |
| | | console.log(this.workTreeData) |
| | | } else { |
| | | this.workTreeData = [] |
| | | } |
| | | }).catch(err => { |
| | | this.workTreeData = [] |
| | | }) |
| | | } |
| | | console.log(val) |
| | | } |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | methods: { |
| | | formatData(data, current) { |
| | | let newData = [] |
| | | if (!current) { |
| | | newData = data.filter(item => item.parentId == 0).map(v => { |
| | | v.children = this.formatData(data, v).sort((a, b) => { |
| | | return b.sort - a.sort |
| | | }) |
| | | return v |
| | | }) |
| | | } else { |
| | | let res = data.filter(v => v.parentId === current.id) |
| | | res = res.map(item => { |
| | | item.children = this.formatData(data, item).sort((a, b) => { |
| | | return b.sort - a.sort |
| | | }) |
| | | return item |
| | | }) |
| | | return res |
| | | } |
| | | return newData |
| | | }, |
| | | init() { |
| | | this.selectNode = { |
| | | id: '' |
| | | } |
| | | this.$HTTP.get(`/api/blade-dnc/folder/folder-tree`).then(res => { |
| | | this.treeData = [{ |
| | | group: true, |
| | | id: 0, |
| | | name: '我的文档', |
| | | children: res.data |
| | | }] |
| | | // this.selectNode = { |
| | | // group: true, |
| | | // id: 0, |
| | | // name: '我的文档', |
| | | // } |
| | | }) |
| | | this.$HTTP.get(`/api/blade-dnc/dnc-process-catalogue/art-tree`).then(res => { |
| | | this.treeData1 = res.data |
| | | }) |
| | | }, |
| | | nodeClick(node) { |
| | | this.selectNode = node |
| | | }, |
| | | onSelectionChange(selection) { |
| | | this.selection = selection |
| | | }, |
| | | getFileList(workstationId) { |
| | | this.$HTTP.post(`/api/blade-dnc/transfer-directory/fileList`, { |
| | | fileLocations: [2], |
| | | workstationId |
| | | }).then(res => { |
| | | if (res.success) { |
| | | |
| | | this.list = res.data |
| | | } else { |
| | | this.list = [] |
| | | } |
| | | }).catch(err => { |
| | | this.list = [] |
| | | }) |
| | | }, |
| | | copy() { |
| | | this.fileType = 1 |
| | | this.visible = true |
| | | this.config.formItems[0].options.data = this.workTreeData |
| | | }, |
| | | copy3() { |
| | | this.fileType = 2 |
| | | this.visible = true |
| | | this.config.formItems[0].options.data = this.workTreeData |
| | | }, |
| | | submit() { |
| | | console.log(this.form) |
| | | let data = { |
| | | workstationDirectoryFileVOList: this.selection.map(v => { |
| | | return { |
| | | contentLength: v.contentLength, |
| | | contentMd5: v.contentMd5, |
| | | contentType: v.contentType, |
| | | fileId: v.id, |
| | | fileSource: v.fileType, |
| | | fileType: this.fileType, |
| | | filename: v.filename || v.name, |
| | | lastModified: v.lastModified || new Date().getTime(), |
| | | link: v.link, |
| | | objectKey: v.objectKey, |
| | | originalFilename: v.originalFilename, |
| | | originalFilename: v.filename || v.name, |
| | | storageSpace: 1, |
| | | storageSpaceId: this.form.storageSpaceId, |
| | | suffix: v.suffix, |
| | | workstationId: '', |
| | | workstationName: '' |
| | | } |
| | | }), |
| | | workstationIds: this.treeChecked |
| | | } |
| | | this.$HTTP.post(`/api/blade-dnc/transfer-directory/duplicate-file`, data).then(res => { |
| | | if (res.success) { |
| | | this.$HTTP.post(`/api/blade-dnc/transfer-directory/file`, data).then(res => { |
| | | this.visible = false |
| | | this.getFileList(this.treeChecked?.[0]) |
| | | }) |
| | | |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | |
| | | height: 100%; |
| | | |
| | | &-item { |
| | | overflow: auto; |
| | | height: 50%; |
| | | flex: 0 0 auto; |
| | | } |