<!--
|
* @Date: 2024-05-20 21:43:10
|
* @LastEditors: Sneed
|
* @LastEditTime: 2024-06-16 16:19:14
|
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/file/admin/index.vue
|
-->
|
<template>
|
<el-main style="height: 100%;">
|
<el-card shadow="never" style="height: 100%;" body-style="height: 100%">
|
<el-container>
|
<el-aside width="200px">
|
<el-tree :expand-on-click-node="false" ref="group" node-key="id" :props="{
|
label: 'name',
|
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 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="filename">
|
</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="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-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>
|
</scTable>
|
</el-main>
|
</el-container>
|
</el-container>
|
|
</el-card>
|
</el-main>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
selection: [],
|
selectNode: {
|
},
|
treeData: [],
|
params: {
|
time: [],
|
startTime: '',
|
endTime: '',
|
keywords: '',
|
workstationId: ''
|
},
|
apiObj: {
|
get: async (data) => {
|
let params = {
|
current: data.current,
|
size: data.size
|
}
|
let data1 = {
|
arId: this.selectNode.id,
|
...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
|
})
|
}
|
},
|
}
|
},
|
mounted() {
|
this.init()
|
},
|
methods: {
|
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.id && node.id !== 0) return
|
this.selectNode = node
|
console.log(node.id)
|
this.$nextTick(() => {
|
this.$refs.table?.reload()
|
})
|
},
|
search() {
|
this.$refs.table.reload()
|
},
|
selectionChange(selection) {
|
this.selection = selection
|
},
|
del(selection) {
|
this.$HTTP.delete(`/api/blade-dnc/dnc-archive-directory-file/remove`, {}, { data: selection.map(v => v.id) }).then(res => {
|
this.search()
|
})
|
},
|
rowClick() {
|
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped></style>
|