| | |
| | | <!-- |
| | | * @Date: 2024-05-16 22:40:01 |
| | | * @LastEditors: Sneed |
| | | * @LastEditTime: 2024-05-18 21:35:42 |
| | | * @LastEditTime: 2024-05-19 19:26:43 |
| | | * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/document/index.vue |
| | | --> |
| | | <template> |
| | |
| | | </template> |
| | | </el-dropdown> |
| | | <el-button type="primary" style="margin-left: 8px;">上传文件</el-button> |
| | | <el-dropdown style="margin-left: 8px;"> |
| | | <el-dropdown style="margin-left: 8px;" :disabled="selection.length == 0"> |
| | | <el-button type="primary"> |
| | | 更多操作<el-icon class="el-icon--right"><el-icon-arrow-down /></el-icon> |
| | | </el-button> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item>复制</el-dropdown-item> |
| | | <el-dropdown-item>移动</el-dropdown-item> |
| | | <el-dropdown-item @click="copy">复制</el-dropdown-item> |
| | | <el-dropdown-item @click="move">移动</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </el-dropdown> |
| | | <el-button style="margin-left: 8px;" type="danger" plain>删除</el-button> |
| | | <el-button style="margin-left: 8px;" type="danger" plain |
| | | :disabled="selection.length == 0">删除</el-button> |
| | | <el-button-group style="margin-left: auto;"> |
| | | <el-button type="primary"> |
| | | <el-button :type="type === 'list' ? 'primary' : ''" @click="type = 'list'"> |
| | | <el-icon> |
| | | <el-icon-fold /> |
| | | </el-icon> |
| | | </el-button> |
| | | <el-button type="primary"> |
| | | <el-button :type="type !== 'list' ? 'primary' : ''" @click="type = 'card'"> |
| | | <el-icon> |
| | | <el-icon-grid /> |
| | | </el-icon> |
| | | </el-button> |
| | | </el-button-group> |
| | | <el-input v-model="input3" style="margin-left: 8px;max-width: 240px" placeholder="请输入关键词" |
| | | class="input-with-select"> |
| | | <el-input v-model="params.searchKey" style="margin-left: 8px;max-width: 240px" |
| | | placeholder="请输入关键词" class="input-with-select"> |
| | | <template #append> |
| | | <el-button type="primary" class="header-search" @click="search"> |
| | | <el-icon> |
| | | <el-icon-search /> |
| | | </el-icon> |
| | | </el-button> |
| | | |
| | | </template> |
| | | </el-input> |
| | | </el-header> |
| | | <el-main> |
| | | <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table" |
| | | :params="params" :apiObj="apiObj" @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="suffix"></el-table-column> |
| | | <el-table-column label="更新时间" prop="updateTime"></el-table-column> |
| | | <el-table-column label="操作" fixed="right" align="right" width="160"> |
| | | <template #default="scope"> |
| | | <el-button-group> |
| | | <el-button text type="primary" size="small" |
| | | @click="table_edit(scope.row, scope.$index)">编辑</el-button> |
| | | <el-popconfirm title="确定删除吗?" @confirm="table_del([scope.row], '0')"> |
| | | <template #reference> |
| | | <el-button text type="primary" size="small">删除</el-button> |
| | | </template> |
| | | </el-popconfirm> |
| | | </el-button-group> |
| | | </template> |
| | | </el-table-column> |
| | | </scTable> |
| | | </el-main> |
| | | </el-container> |
| | | </el-container> |
| | | </el-card> |
| | |
| | | name: [{ |
| | | required: true, message: '必填' |
| | | }] |
| | | } |
| | | }, |
| | | params: { |
| | | searchKey: '', |
| | | }, |
| | | apiObj: { |
| | | get: async (data) => { |
| | | let params = { |
| | | ...data, |
| | | parent: this.selectNode.id, |
| | | ...this.params |
| | | } |
| | | return await this.$HTTP.get(`/api/blade-dnc/folder/page`, {}, { params }).then(res => { |
| | | return res |
| | | }) |
| | | } |
| | | }, |
| | | selection: [], |
| | | type: 'list' |
| | | } |
| | | }, |
| | | created() { |
| | | watch: { |
| | | 'selectNode.id': function () { |
| | | this.search() |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.init() |
| | | }, |
| | | methods: { |
| | |
| | | this.selectNode = node |
| | | }, |
| | | search() { |
| | | alert(1) |
| | | this.$refs?.table.reload() |
| | | }, |
| | | // 新增文件夹 |
| | | addFolder() { |
| | | this.visible = true |
| | | this.form = {} |
| | | this.form = { isNewFile: false } |
| | | }, |
| | | saveFolder() { |
| | | console.log(this.form) |
| | | this.$HTTP |
| | | let data = { |
| | | ...this.form, |
| | | parent: this.selectNode.id |
| | | } |
| | | try { |
| | | Reflect.deleteProperty(data, 'isNewFile') |
| | | } catch (error) { |
| | | |
| | | } |
| | | this.$HTTP.post(`/api/blade-dnc/folder`, data).then(res => { |
| | | this.init() |
| | | }) |
| | | }, |
| | | selectionChange(selection) { |
| | | this.selection = selection |
| | | }, |
| | | action() { |
| | | |
| | | }, |
| | | copy() { |
| | | this.$HTTP.post(`/api/blade-dnc/file/copy`, { parentId: this.formFile.parentId, sourceIdList: this.selection.map(v => v.id) }) |
| | | }, |
| | | move() { |
| | | this.$HTTP.post(`/api/blade-dnc/file/move`, { parentId: this.formFile.parentId, sourceIdList: this.selection.map(v => v.id) }) |
| | | }, |
| | | async del() { |
| | | let confirm = await this.$HTTP.post(`/api/blade-dnc/file/exists-file`).then(res => { |
| | | if (res.data) { |
| | | return res.data |
| | | } |
| | | }) |
| | | let delFlag = true |
| | | if (confirm) { |
| | | delFlag = await this.$confirm(`此操作会将当前文件夹下的所有文件删除,是否继续??`, '提示', { |
| | | type: 'warning', |
| | | }).then(() => { |
| | | return true |
| | | }).catch(() => { |
| | | return false |
| | | }) |
| | | } |
| | | if (!delFlag) { |
| | | return |
| | | } |
| | | this.$HTTP.post(`/api/blade-dnc/file`, { sourceIdList: this.selection.map(v => v.id) }).then(res => { |
| | | this.init() |
| | | }) |
| | | } |
| | | } |
| | | } |