This commit is contained in:
yanran200730
2022-12-13 16:04:54 +08:00
parent e8ff014598
commit 01c48a1cd6
3 changed files with 80 additions and 37 deletions

View File

@@ -20,6 +20,7 @@
<div class="addressBook-left__list--wrapper">
<div class="addressBook-left__list">
<el-tree
v-if="isShowTree"
:filter-node-method="filterNode"
ref="tree"
:props="defaultProps"
@@ -50,10 +51,10 @@
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加成员</el-button>
<!-- <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加成员</el-button> -->
</template>
<template slot="right">
<el-input
<!-- <el-input
v-model="search.name"
size="small"
v-throttle="() => {search.current = 1, getList()}"
@@ -61,7 +62,7 @@
clearable
@clear="search.current = 1, search.name = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</el-input> -->
</template>
</ai-search-bar>
<ai-table
@@ -75,8 +76,7 @@
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
<el-button type="text" @click="remove(row.id)">删除</el-button>
<el-button type="text" @click="remove(row.fileId)">删除</el-button>
</div>
</template>
</el-table-column>
@@ -114,6 +114,7 @@
y: '',
node: {}
},
isShowTree: true,
form: {
folderName: ''
},
@@ -133,7 +134,7 @@
colConfigs: [
{ prop: 'fileName', label: '名称' },
{ prop: 'ctime', label: '文件创建时间', formart: v => v ? this.$moment(v * 1000).format('YYYY-MM-DD HH:mm:ss') : '-' },
{ prop: 'departmentNames', label: '创建人' }
// { prop: 'departmentNames', label: '创建人' }
],
defaultProps: {
children: 'children',
@@ -189,33 +190,60 @@
this.isShow = true
} else if (e === 'edit') {
this.form = {
...item
...item,
folderName: item.fileName
}
this.isShow = true
} else if (e === 'remove') {
this.remove(item.fileId, item.spaceid)
this.remove(item.fileId)
}
},
onConfirm () {
this.$refs.form.validate((valid) => {
if (valid) {
this.instance.post(`/app/wxwedrive/createWedriveFloder`, null, {
params: {
...this.form,
spaceid: this.spaceid,
fatherid: this.fatherid
}
}).then(res => {
this.search.spaceid = this.spaceid
this.search.fatherid = this.fatherid
if (res.code == 0) {
this.defaultChecked = [this.spaceid]
this.getList()
this.isShow = false
this.$message.success(this.departId ? '编辑成功' : '新增成功')
}
})
if (this.form.fileId) {
this.instance.post(`/app/wxwedrive/fileRename`, null, {
params: {
newName: this.form.folderName,
fileid: this.form.fileId
}
}).then(res => {
if (res.code == 0) {
this.isShowTree = false
this.defaultChecked = [this.spaceid]
this.getList()
this.isShow = false
this.$message.success('编辑成功')
this.$nextTick(() => {
this.isShowTree = true
})
}
})
} else {
this.instance.post(`/app/wxwedrive/createWedriveFloder`, null, {
params: {
...this.form,
spaceid: this.spaceid,
fatherid: this.fatherid
}
}).then(res => {
this.search.spaceid = this.spaceid
this.search.fatherid = this.fatherid
if (res.code == 0) {
this.isShowTree = false
this.defaultChecked = [this.spaceid]
this.getList()
this.isShow = false
this.$message.success('新增成功')
this.$nextTick(() => {
this.isShowTree = true
})
}
})
}
}
})
},
@@ -256,10 +284,15 @@
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/wxwedrive/fileDelete?id=${id}`).then(res => {
this.instance.post(`/app/wxwedrive/fileDelete?fileid=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.isShowTree = false
this.getList()
this.$nextTick(() => {
this.isShowTree = true
})
}
})
})