¶Ô±ÈÐÂÎļþ |
| | |
| | | <!-- |
| | | * @Date: 2024-06-12 22:07:23 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-06-13 00:07:27 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/craft/document/File.vue |
| | | --> |
| | | <template> |
| | | <div> |
| | | <scDialog style="min-height: 400px;" v-model="visible"> |
| | | <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="handleClick"> |
| | | <el-tab-pane label="æçææ¡£" name="1"> |
| | | <el-container v-if="activeName == '1'"> |
| | | <el-aside width="220px"> |
| | | <el-row> |
| | | <el-col> |
| | | <el-input style="width: 180px;" v-model="filterText" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-col> |
| | | <el-col style="margin-top: 8px;"> |
| | | <el-tree ref="treeRef" default-expand-all node-key="id" :data="treeData" :props="{ |
| | | label: 'name', |
| | | }" @node-click="nodeClick" :filter-node-method="filterNode" 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-col> |
| | | </el-row> |
| | | |
| | | </el-aside> |
| | | <el-container> |
| | | <el-header> |
| | | <el-input style="width: 180px;" v-model="searchKey" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-header> |
| | | <el-main v-if="selectNode?.id !== ''"> |
| | | <scTable highlight-current-row ref="table" :apiObj="apiObj1" |
| | | @selection-change="selectionChange" stripe> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <el-table-column label="æä»¶åç§°" prop="name"> |
| | | </el-table-column> |
| | | <el-table-column label="æä»¶è·¯å¾" prop="allPathName"></el-table-column> |
| | | <el-table-column label="大å°" prop="contentLength"></el-table-column> |
| | | <el-table-column label="çæ¬" prop="version"></el-table-column> |
| | | <el-table-column label="æä»¶ç±»å" prop="suffix"></el-table-column> |
| | | <el-table-column label="æ´æ°æ¶é´" prop="updateTime"></el-table-column> |
| | | </scTable> |
| | | </el-main> |
| | | </el-container> |
| | | |
| | | |
| | | </el-container> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="工使件" name="2"> |
| | | <el-container v-if="activeName == '2'"> |
| | | <el-aside width="220px"> |
| | | <el-row> |
| | | <el-col> |
| | | <el-input style="width: 180px;" v-model="filterText" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-col> |
| | | <el-col style="margin-top: 8px;"> |
| | | <el-tree :load="loadNode" ref="treeRef" default-expand-all node-key="id" :props="{ |
| | | label: 'name', |
| | | hasChildren: 'id' |
| | | }" @node-click="nodeClick" :filter-node-method="filterNode" highlight-current |
| | | :current-node-key="selectNode?.id" lazy> |
| | | <template #default="{ node, data }"> |
| | | <span :class="data.isGroup ? 'active' : ''" class="custom-tree-node"> |
| | | <span>{{ |
| | | node.label || data.code }}</span> |
| | | </span> |
| | | </template> |
| | | </el-tree> |
| | | </el-col> |
| | | </el-row> |
| | | </el-aside> |
| | | <el-container> |
| | | <el-header> |
| | | <el-input style="width: 180px;" v-model="searchKey" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-header> |
| | | <el-main v-if="selectNode?.id !== ''"> |
| | | <scTable highlight-current-row ref="table" :apiObj="apiObj2" |
| | | @selection-change="selectionChange" stripe> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <el-table-column label="æä»¶åç§°" prop="filename"> |
| | | </el-table-column> |
| | | <el-table-column label="大å°" prop="contentLength"></el-table-column> |
| | | <el-table-column label="çæ¬" prop="version"></el-table-column> |
| | | <el-table-column label="æä»¶ç±»å" prop="suffix"></el-table-column> |
| | | <el-table-column label="æä»¶å½å±" prop="documentOwnershipDesc"></el-table-column> |
| | | <el-table-column label="å卿¶é´" prop="storageSpaceDec"></el-table-column> |
| | | </scTable> |
| | | </el-main> |
| | | </el-container> |
| | | </el-container> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="彿¡£æä»¶" name="3"> |
| | | <el-container v-if="activeName == '3'"> |
| | | <el-aside width="220px"> |
| | | <el-row> |
| | | <el-col> |
| | | <el-input style="width: 180px;" v-model="filterText" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-col> |
| | | <el-col style="margin-top: 8px;"> |
| | | <el-tree :load="loadNode1" ref="treeRef" default-expand-all node-key="id" :props="{ |
| | | label: 'name', |
| | | hasChildren: 'id' |
| | | }" @node-click="nodeClick" :filter-node-method="filterNode" highlight-current |
| | | :current-node-key="selectNode?.id" lazy> |
| | | <template #default="{ node, data }"> |
| | | <span :class="data.isGroup ? 'active' : ''" class="custom-tree-node"> |
| | | <span>{{ |
| | | node.label || data.name }}</span> |
| | | </span> |
| | | </template> |
| | | </el-tree> |
| | | </el-col> |
| | | </el-row> |
| | | </el-aside> |
| | | <el-container> |
| | | <el-header> |
| | | <el-input style="width: 180px;" v-model="searchKey" placeholder="请è¾å
¥å
³é®è¯è¿è¡è¿æ»¤" /> |
| | | </el-header> |
| | | <el-main v-if="selectNode?.id !== ''"> |
| | | <scTable highlight-current-row ref="table" :apiObj="apiObj3" |
| | | @selection-change="selectionChange" stripe> |
| | | <el-table-column type="selection" width="50"></el-table-column> |
| | | <el-table-column label="æä»¶åç§°" prop="filename"> |
| | | </el-table-column> |
| | | <el-table-column label="大å°" prop="contentLength"></el-table-column> |
| | | <el-table-column label="çæ¬" prop="version"></el-table-column> |
| | | <el-table-column label="æä»¶ç±»å" prop="suffix"></el-table-column> |
| | | </scTable> |
| | | </el-main> |
| | | </el-container> |
| | | </el-container> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="æ¬å°ä¸ä¼ " name="4"> |
| | | <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload" :http-request="request"> |
| | | <el-button type="primary">ä¸ä¼ æä»¶</el-button> |
| | | </el-upload> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | <template #footer> |
| | | <el-button type="primary" @click="save">ç¡®å®</el-button> |
| | | </template> |
| | | </scDialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | watch: { |
| | | filterText(val) { |
| | | this.$refs.treeRef.filter(val) |
| | | }, |
| | | 'selectNode.id'(val) { |
| | | this.$refs.table.reload() |
| | | }, |
| | | activeName(val) { |
| | | this.selection = [] |
| | | if (val === '1') { |
| | | this.init() |
| | | } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | activeName: '1', |
| | | visible: false, |
| | | filterText: '', |
| | | selectNode: { |
| | | id: '' |
| | | }, |
| | | treeData: [], |
| | | fileType: 1, |
| | | searchKey: '', |
| | | selection: [], |
| | | apiObj1: { |
| | | get: async (data) => { |
| | | let params = { |
| | | ...data, |
| | | fileType: this.fileType, |
| | | parent: this.selectNode.id, |
| | | searchKey: this.searchKey |
| | | // ...this.params |
| | | } |
| | | return await this.$HTTP.get(`/api/blade-dnc/folder/file-page`, {}, { params }).then(res => { |
| | | return res |
| | | }) |
| | | } |
| | | }, |
| | | apiObj2: { |
| | | get: async (data) => { |
| | | let params = { |
| | | ...data, |
| | | } |
| | | let newData = { |
| | | fileType: `${this.fileType}`, |
| | | keywords: this.searchKey, |
| | | workstationId: this.selectNode.id |
| | | } |
| | | return await this.$HTTP.post(`/api/blade-dnc/transfer-directory/page`, {}, { params, data: newData }).then(res => { |
| | | return { |
| | | success: true, |
| | | code: 200, |
| | | data: { |
| | | ...res |
| | | } |
| | | |
| | | } |
| | | |
| | | }) |
| | | } |
| | | }, |
| | | apiObj3: { |
| | | get: async (data) => { |
| | | let params = { |
| | | ...data, |
| | | } |
| | | let newData = { |
| | | fileType: `${this.fileType}`, |
| | | keywords: this.searchKey, |
| | | arId: this.selectNode.id |
| | | } |
| | | return await this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/page`, {}, { params, data: newData }).then(res => { |
| | | return res |
| | | }) |
| | | } |
| | | }, |
| | | id: '' |
| | | } |
| | | }, |
| | | created() { |
| | | }, |
| | | methods: { |
| | | open(fileType, id) { |
| | | this.visible = true |
| | | this.fileType = fileType |
| | | this.activeName = '1' |
| | | this.id = id |
| | | this.init() |
| | | }, |
| | | filterNode(value, data) { |
| | | console.log(value, data) |
| | | if (!value) return true |
| | | return data.name.includes(value) |
| | | }, |
| | | nodeClick(node) { |
| | | this.selectNode = node |
| | | }, |
| | | init() { |
| | | 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: 'æçææ¡£', |
| | | } |
| | | }) |
| | | }, |
| | | loadNode(node, resolve) { |
| | | let id = node.level === 0 ? '' : node.data.id |
| | | if (node.level === 0) { |
| | | return this.$HTTP.get(`/api/blade-cps/group/getRootNode?groupCategory=1&groupType=group_workstation`).then(res => { |
| | | this.nodeClick(res.data) |
| | | resolve([res.data].map(v => { |
| | | return { |
| | | ...v, |
| | | name: v.name, |
| | | id: v.id |
| | | } |
| | | })) |
| | | }) |
| | | } else { |
| | | this.$HTTP.get(`/api/blade-cps/group/groupWorkstation/lazy?groupId=${id}`).then(res => { |
| | | resolve(res.data.map(v => { |
| | | return { |
| | | ...v, |
| | | name: v.title |
| | | } |
| | | })) |
| | | }) |
| | | } |
| | | }, |
| | | loadNode1(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.map(v => { |
| | | return { |
| | | ...v, |
| | | } |
| | | })) |
| | | }) |
| | | }, |
| | | selectionChange(selection) { |
| | | this.selection = selection |
| | | }, |
| | | request(options) { |
| | | const formData = new FormData() |
| | | formData.append('file', options.file) |
| | | console.log(options) |
| | | this.$HTTP.post(`/api/blade-resource/oss/endpoint/put-file`, formData).then(resFile => { |
| | | this.$HTTP.post(`/api/blade-dnc/dnc-art-file/duplicate-validation-file`, { |
| | | artBagId: this.id, artFileAddVOList: [{ |
| | | fileType: `${this.fileType}`, |
| | | filename: resFile.data.originalName, |
| | | objectKey: resFile.data.name |
| | | }] |
| | | }).then(res => { |
| | | if (res.success) { |
| | | this.$HTTP.post(`/api/blade-dnc/dnc-art-file/insert`, [{ |
| | | artBagId: this.id, |
| | | fileType: `${this.fileType}`, |
| | | contentLength: options.file.size, |
| | | filename: options.file.name, |
| | | link: resFile.data.link, |
| | | objectKey: resFile.data.name, |
| | | originalFilename: options.file.name, |
| | | sourceType: 3, |
| | | suffix: resFile.data.originalName.split('.').pop(), |
| | | }]).then(res => { |
| | | this.success(res) |
| | | }) |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | save() { |
| | | console.log(this.selection) |
| | | if (this.selection.length == 0) { |
| | | this.visible = false |
| | | } else { |
| | | this.$HTTP.post(`/api/blade-dnc/dnc-art-file/duplicate-validation-file`, { |
| | | artBagId: this.id, artFileAddVOList: this.selection.map(v => { |
| | | return { |
| | | contentMd5: v.contentMd5, |
| | | fileType: `${this.fileType}`, |
| | | filename: v.filename, |
| | | objectKey: v.objectKey |
| | | } |
| | | }) |
| | | }).then(res => { |
| | | if (res.success) { |
| | | this.$HTTP.post(`/api/blade-dnc/dnc-art-file/insert`, this.selection.map(v => { |
| | | return { |
| | | artBagId: this.id, |
| | | contentLength: v.contentLength, |
| | | contentMd5: v.contentMd5, |
| | | contentType: v.contentType, |
| | | fileId: v.id, |
| | | fileType: `${this.fileType}`, |
| | | filename: v.filename, |
| | | link: v.link, |
| | | objectKey: v.objectKey, |
| | | suffix: v.suffix |
| | | } |
| | | })).then(res => { |
| | | this.success(res) |
| | | }) |
| | | } else { |
| | | this.$message.error(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | success(res) { |
| | | if (res.success) { |
| | | this.visible = false |
| | | this.$emit('success') |
| | | this.$message.success(res.msg) |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped></style> |