|
@@ -2,30 +2,33 @@
|
|
|
<div>
|
|
|
<!-- 穿梭框 -->
|
|
|
<div>
|
|
|
- <el-dialog v-model="transferModals" title="分享" :close-on-click-modal="false">
|
|
|
+ <el-dialog v-model="transferModals" title="分享" width="40%" :close-on-click-modal="false">
|
|
|
<div class="transBox">
|
|
|
<div class="allBag">
|
|
|
- <el-input style="width: 220px;margin-left: 18px;margin-top:5px" v-model="allBag"
|
|
|
- placeholder="搜索"></el-input>
|
|
|
+ <div style="position: relative;">
|
|
|
+ <el-input style="width: 220px;margin-left: 18px;margin-top:5px" v-model="allBag"
|
|
|
+ placeholder="搜索"></el-input>
|
|
|
+ </div>
|
|
|
<div class="allLog">
|
|
|
- <el-tree ref="treeRef" :data="allTreeData" :props="allTreeProps" show-checkbox node-key="id"
|
|
|
- :default-expanded-keys="openTree" @check-change="allTreeChange"
|
|
|
- :default-checked-keys="backScreen" :check-strictly="false" />
|
|
|
+ <el-tree :filter-node-method="filterNode" v-if="have" ref="treeRef" :data="allTreeData"
|
|
|
+ :props="allTreeProps" show-checkbox node-key="id" :default-expanded-keys="openTree"
|
|
|
+ @check-change="allTreeChange" :default-checked-keys="backScreen" :check-strictly="false" />
|
|
|
+ <span v-else>暂无数据</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="needBag">
|
|
|
<div style="border-bottom: 1px solid gray;" class="needBag_top">
|
|
|
<span>已选择{{ chooseTagData.length }}人</span>
|
|
|
- <span style="color: red;font-size: 14px;float: right;">清空</span>
|
|
|
+ <span style="color: red;font-size: 14px;float: right;cursor: pointer;"
|
|
|
+ @click="cleanPeople">清空</span>
|
|
|
</div>
|
|
|
<div class="needLog">
|
|
|
- <el-scrollbar height="349px">
|
|
|
- <el-tag v-for="(item, index) in chooseTagData" :key="index" class="tagtag"
|
|
|
- :closable="lastPeople" @close="handleClose(item)">
|
|
|
+ <el-scrollbar height="349px">
|
|
|
+ <el-tag v-for="(item, index) in chooseTagData" :key="index" class="tagtag" :closable="true"
|
|
|
+ @close="handleClose(item)">
|
|
|
{{ item.userName ? item.userName : item.name }}
|
|
|
- </el-tag>
|
|
|
- </el-scrollbar>
|
|
|
-
|
|
|
+ </el-tag>
|
|
|
+ </el-scrollbar>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -43,7 +46,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { ref, onMounted, toRef } from 'vue';
|
|
|
+import { ref, onMounted, toRef, watch } from 'vue';
|
|
|
import userTree from '../../../api/user/userTree';
|
|
|
import fileShare from '../../../api/fileShare/fileShare';
|
|
|
import fileCount from '../../../api/fileCount/fileCount'
|
|
@@ -52,15 +55,15 @@ export default {
|
|
|
props: {
|
|
|
thanks: {
|
|
|
type: Boolean,
|
|
|
- // required: true
|
|
|
+ required: true
|
|
|
},
|
|
|
clickRowId: {
|
|
|
type: Number,
|
|
|
- // required: true
|
|
|
+ required: true
|
|
|
},
|
|
|
workOrEdit: {
|
|
|
type: Number,
|
|
|
- // required: true
|
|
|
+ required: true
|
|
|
},
|
|
|
isNewMenu: {
|
|
|
type: Boolean,
|
|
@@ -81,12 +84,15 @@ export default {
|
|
|
disabled: false,
|
|
|
id: "id"
|
|
|
}
|
|
|
+ let treeRef = ref(null)
|
|
|
let openTree = ref([])
|
|
|
let chooseTagData = ref([])
|
|
|
let allBag = ref('')
|
|
|
let needTagData = ref([])
|
|
|
let backScreen = ref([])
|
|
|
let lastPeople = ref(false)
|
|
|
+ let allCancel = ref(false)
|
|
|
+ let have = ref(true)
|
|
|
function allTeam() {
|
|
|
if (result) {
|
|
|
transferModals.value = result
|
|
@@ -94,6 +100,7 @@ export default {
|
|
|
}
|
|
|
// 分享穿梭框
|
|
|
function allTreeChange(e) {
|
|
|
+ // console.log('触发了change事件'+ 1++);
|
|
|
const id = e.id;
|
|
|
const label = e.label;
|
|
|
const disabled = e.disabled;
|
|
@@ -104,15 +111,15 @@ export default {
|
|
|
chooseTagData.value.splice(existingIndex, 1);
|
|
|
} else {
|
|
|
// 选择操作,将数据添加到 needTagData 中
|
|
|
- chooseTagData.value.push({ userId: id, userName: label ,disabled:disabled});
|
|
|
+ chooseTagData.value.push({ userId: id, userName: label, disabled: disabled });
|
|
|
}
|
|
|
if (chooseTagData.value.length === 1) {
|
|
|
lastPeople.value = true
|
|
|
} else {
|
|
|
lastPeople.value = false
|
|
|
}
|
|
|
- chooseTagData.value = chooseTagData.value.filter(item=>!item.disabled)
|
|
|
- console.log('chooseTagData',chooseTagData.value);
|
|
|
+ chooseTagData.value = chooseTagData.value.filter(item => !item.disabled)
|
|
|
+ // console.log('chooseTagData初始数组',chooseTagData.value);
|
|
|
}
|
|
|
// 确认分享
|
|
|
function sureShare() {
|
|
@@ -166,9 +173,7 @@ export default {
|
|
|
}
|
|
|
// 获取用户树
|
|
|
function getAllUser() {
|
|
|
- console.log('feeh',feeh);
|
|
|
userTree.getUserTree({}).then(res => {
|
|
|
- console.log('userTree',res);
|
|
|
allTreeData.value = [res]
|
|
|
userTree.getUserTree({}).then(res => {
|
|
|
allTreeData.value = [res];
|
|
@@ -196,11 +201,8 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
- if(feeh === 0){
|
|
|
- fileCount.getActor(dees).then(res => {
|
|
|
- // 去除数组内部的重复元素
|
|
|
- // const uniqueRes = Array.from(new Set(res.map(item => item.userName))).map(id => res.find(item => item.userName === id));
|
|
|
- // 现在的 uniqueRes 数组不包含重复元素
|
|
|
+ if (feeh === 0) {
|
|
|
+ fileCount.getActor(dees).then(res => {
|
|
|
chooseTagData.value = res;
|
|
|
backScreen.value = chooseTagData.value.map(item => {
|
|
|
return item.userId
|
|
@@ -213,17 +215,57 @@ export default {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ function cleanPeople() {
|
|
|
+ treeRef.value.setCheckedKeys([]);
|
|
|
+ chooseTagData.value = [];
|
|
|
+ setTimeout(() => {
|
|
|
+ antherClean()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function antherClean() {
|
|
|
+ treeRef.value.setCheckedKeys([]);
|
|
|
+ chooseTagData.value = [];
|
|
|
+ }
|
|
|
+ function searchInTreeData(treeData, searchValue) {
|
|
|
+ const foundItems = [];
|
|
|
+ function traverseTree(node) {
|
|
|
+ if (node.label.includes(searchValue)) {
|
|
|
+ foundItems.push(node);
|
|
|
+ }
|
|
|
+ if (node.children) {
|
|
|
+ node.children.forEach(childNode => traverseTree(childNode));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ treeData.forEach(node => traverseTree(node));
|
|
|
+ return foundItems;
|
|
|
+ }
|
|
|
+ watch(()=>allBag.value,(val)=>{
|
|
|
+ treeRef.value?.filter(val)
|
|
|
+ })
|
|
|
+ function filterNode(value, data) {
|
|
|
+ if (!value) return true
|
|
|
+ return data.label.includes(value)
|
|
|
+ }
|
|
|
function getBack() {
|
|
|
transferModals.value = false
|
|
|
emit("getCback", transferModals.value)
|
|
|
}
|
|
|
function handleClose(tag) {
|
|
|
chooseTagData.value.splice(chooseTagData.value.indexOf(tag), 1);
|
|
|
- // 从标签中获取 userId
|
|
|
- // const userId = tag.userId;
|
|
|
- // 从 chooseTagData 中筛选出不包含当前 userId 的标签
|
|
|
- // chooseTagData.value = chooseTagData.value.filter(item => item.userId !== userId)
|
|
|
-
|
|
|
+ let result = chooseTagData.value.map((item) => {
|
|
|
+ return item.userId
|
|
|
+ })
|
|
|
+ treeRef.value.setCheckedKeys(result);
|
|
|
+ setTimeout(() => {
|
|
|
+ antherClose(tag)
|
|
|
+ }, 10)
|
|
|
+ }
|
|
|
+ function antherClose(tag) {
|
|
|
+ chooseTagData.value.splice(chooseTagData.value.indexOf(tag), 1);
|
|
|
+ let result = chooseTagData.value.map((item) => {
|
|
|
+ return item.userId
|
|
|
+ })
|
|
|
+ treeRef.value.setCheckedKeys(result);
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
allTeam()
|
|
@@ -248,6 +290,10 @@ export default {
|
|
|
lastPeople,
|
|
|
feeh,
|
|
|
backToFather: getBack,
|
|
|
+ cleanPeople,
|
|
|
+ treeRef,
|
|
|
+ have,
|
|
|
+ filterNode,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -275,14 +321,16 @@ export default {
|
|
|
|
|
|
.allBag {
|
|
|
width: 255px;
|
|
|
- height: 380px;
|
|
|
+ height: 400px;
|
|
|
border: 1px solid green;
|
|
|
+ overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
.needBag {
|
|
|
width: 255px;
|
|
|
- height: 380px;
|
|
|
+ height: 400px;
|
|
|
border: 1px solid green;
|
|
|
+ overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
.allLog {
|
|
@@ -291,16 +339,20 @@ export default {
|
|
|
margin: 5px auto;
|
|
|
/* border: 1px solid red; */
|
|
|
overflow-y: auto;
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
-.needBag_top{
|
|
|
+
|
|
|
+.needBag_top {
|
|
|
padding: 0 10px;
|
|
|
height: 30px;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
}
|
|
|
-.needLog{
|
|
|
+
|
|
|
+.needLog {
|
|
|
height: 100%;
|
|
|
+ overflow-y: auto;
|
|
|
}
|
|
|
|
|
|
:deep(.el-tag__content) {
|
|
@@ -310,4 +362,8 @@ export default {
|
|
|
:deep(.el-icon el-tag__close) {
|
|
|
display: block;
|
|
|
}
|
|
|
+
|
|
|
+:deep(.el-scrollbar__wrap .el-scrollbar__wrap--hidden-default) {
|
|
|
+ height: 346px !important;
|
|
|
+}
|
|
|
</style>
|