From f40836bbcd74b931b332a1c262e6776af1e4cc14 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期日, 23 六月 2024 21:10:05 +0800 Subject: [PATCH] update --- src/views/dnc/file/admin/index.vue | 111 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 82 insertions(+), 29 deletions(-) diff --git a/src/views/dnc/file/admin/index.vue b/src/views/dnc/file/admin/index.vue index f0721d2..73a5875 100644 --- a/src/views/dnc/file/admin/index.vue +++ b/src/views/dnc/file/admin/index.vue @@ -1,7 +1,7 @@ <!-- * @Date: 2024-05-20 21:43:10 * @LastEditors: Sneed - * @LastEditTime: 2024-05-20 22:18:51 + * @LastEditTime: 2024-06-16 16:19:14 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/file/admin/index.vue --> <template> @@ -9,33 +9,51 @@ <el-card shadow="never" style="height: 100%;" body-style="height: 100%"> <el-container> <el-aside width="200px"> - <el-tree default-expand-all ref="group" node-key="id" :data="treeData" :props="{ + <el-tree :expand-on-click-node="false" ref="group" node-key="id" :props="{ label: 'name', - }" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id"></el-tree> + hasChildren: 'id' + }" :load="loadNode" @node-click="nodeClick" lazy></el-tree> </el-aside> <el-container> <el-header> <el-button style="margin-left: 8px;margin-right: auto;" type="danger" plain :disabled="selection.length == 0" @click="del(selection)">鍒犻櫎</el-button> + <el-tree-select v-model="params.workstationId" default-expand-all clearable :data="treeData" + :render-after-expand="false" style="width: 240px;margin-left: auto;" :props="{ + label: 'title', + }" node-key="id"> + <template #prefix><span style="margin-right: 6px;">宸ヤ綅鐩綍</span></template> + </el-tree-select> + <el-date-picker style="width: 260px;flex-grow: 0;margin-left: 8px;" v-model="params.time" + type="daterange" range-separator="-" start-placeholder="寮�濮嬫椂闂�" end-placeholder="缁撴潫鏃堕棿" /> + <el-input v-model="params.keywords" style="width: 240px;margin-left: 8px;" placeholder="鏂囦欢鍚嶇О銆佸悗缂�" + clearable> + <template #prefix>鍏抽敭璇�</template> + </el-input> + <el-button style="margin-left: 8px;" @click="search" type="primary" + icon="el-icon-search"></el-button> </el-header> <el-main> - <scTable highlight-current-row @dataChange="dataChange" @row-click="rowClick" ref="table" - :params="params" :apiObj="apiObj" @selection-change="selectionChange" stripe> + <scTable v-if="selectNode.id || selectNode.id === 0" 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 label="鏂囦欢鍚嶇О" prop="filename"> </el-table-column> - <el-table-column label="鐗堟湰" prop="allPathName"></el-table-column> + <el-table-column label="宸ヤ綅鐩綍" prop="workstationName"></el-table-column> + <el-table-column label="鐗堟湰" prop="versionDesc"></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="鍒涘缓鏃堕棿" prop="updateTime"></el-table-column> + <el-table-column label="鏇存柊浜�" prop="createUserName"></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-button text type="primary" size="small" - @click="del([scope.row])">鍒犻櫎</el-button> + <el-popconfirm width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="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> @@ -54,10 +72,10 @@ return { selection: [], selectNode: { - id: '' }, treeData: [], params: { + time: [], startTime: '', endTime: '', keywords: '', @@ -71,7 +89,9 @@ } let data1 = { arId: this.selectNode.id, - ...this.params + ...this.params, + startTime: this.params.time[0] || '', + endTime: this.params.time[1] || '' } return await this.$HTTP.post(`/api/blade-dnc/dnc-archive-directory-file/page`, {}, { params, data: data1 }).then(res => { return res @@ -84,36 +104,69 @@ this.init() }, methods: { - init() { - this.$HTTP.get(`/api/blade-dnc/dnc-archive-directory/list?parentId=`).then(res => { - console.log(res.data, '>>>>>') - this.treeData = res.data - this.nodeClick(res.data[0]) + 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 => { + if (node.level === 0) { + + this.nodeClick(res.data[0]) + } + resolve(res.data) }) }, + init() { + this.$HTTP.post(`/api/blade-cps/group/groupWorkstation`, { groupCategory: 1, groupType: 'group_workstation' }).then(res => { + 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) + 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) + item.disabled = !item.isWorkstation + return item + }) + return res + } + return newData + }, nodeClick(node) { - if (!node) return + if (!node.id && node.id !== 0) return this.selectNode = node console.log(node.id) this.$nextTick(() => { - this.$refs?.table?.reload() + this.$refs.table?.reload() }) + }, + search() { + this.$refs.table.reload() }, selectionChange(selection) { this.selection = selection }, del(selection) { - - }, - table_edit() { - + this.$HTTP.delete(`/api/blade-dnc/dnc-archive-directory-file/remove`, {}, { data: selection.map(v => v.id) }).then(res => { + this.search() + }) }, rowClick() { }, - dataChange() { - - } } } </script> -- Gitblit v1.9.3