fix
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run

This commit is contained in:
caiyx 2025-01-08 09:18:41 +08:00
parent 5e32b9ae03
commit 268c131aa7
10 changed files with 1040 additions and 110 deletions

View File

@ -1,6 +1,5 @@
import request from '@/service/index.js' import request from '@/service/index.js'
// 查询用户群聊服务接口
export const departmentV2TreeMy = (data) => { export const departmentV2TreeMy = (data) => {
return request({ return request({
url: '/department/v2/tree/my', url: '/department/v2/tree/my',
@ -9,3 +8,20 @@ export const departmentV2TreeMy = (data) => {
data, data,
}) })
} }
export const departmentV2AllPosition = (data) => {
return request({
url: '/department/v2/tree/all/position',
baseURL:import.meta.env.VITE_EPR_BASEURL,
method: 'POST',
data,
})
}
export const groupCreateDept = (data) => {
return request({
url: '/api/v1/group/create-dept',
method: 'POST',
data,
})
}

View File

@ -7,3 +7,21 @@ export const ServeGetUserSetting = (data) => {
data, data,
}) })
} }
export const userInfoApi = (data) => {
return request({
url: '/user/info',
method: 'POST',
data,
baseURL:import.meta.env.VITE_EPR_BASEURL,
})
}
export const userLeaderApi = (data) => {
return request({
url: '/oa/user/other-info',
method: 'POST',
data,
baseURL:import.meta.env.VITE_EPR_BASEURL,
})
}

View File

@ -46,6 +46,14 @@
"enablePullDownRefresh":false "enablePullDownRefresh":false
} }
}, },
{
"path": "pages/chooseGroupAdmin/index",
"type": "page",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh":false
}
},
{ {
"path": "pages/chooseChat/index", "path": "pages/chooseChat/index",
"type": "page", "type": "page",

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="outer-layer"> <div class="outer-layer">
<div> <div>
<tm-navbar :hideBack="false" hideHome title="选择群类型"> </tm-navbar> <tm-navbar :hideBack="false" hideHome title="选择部门"> </tm-navbar>
</div> </div>
<div class="root"> <div class="root">
<div <div
@ -48,12 +48,12 @@
</div> </div>
<div <div
class="pl-[32rpx] bg-[#FFFFFF] mt-[20rpx] h-[110rpx] flex items-center" class="pl-[32rpx] bg-[#FFFFFF] mt-[20rpx] h-[110rpx] flex items-center"
@click="()=>allCheck(currentCrumbs.checkStatus)" @click="()=>allCheck(allCheckStatus)"
> >
<div> <div>
<checkBox <checkBox
:disabled="currentCrumbs?.sons?.length === 0" :disabled="currentCrumbs?.sons?.length === 0"
:modelValue="currentCrumbs.checkStatus" :modelValue="allCheckStatus"
></checkBox> ></checkBox>
</div> </div>
<div class="font-bold text-[28rpx] leading-[54rpx] ml-[20rpx]"> <div class="font-bold text-[28rpx] leading-[54rpx] ml-[20rpx]">
@ -105,23 +105,77 @@
</div> </div>
</div> </div>
</div> </div>
<div class="h-[162rpx] flex justify-center bg-[#FFFFFF]"> <div class="h-[162rpx] pl-[32rpx] pr-[32rpx] bg-[#FFFFFF]">
<div class="mt-[14rpx] btnBox"> <div class="mt-[14rpx] flex justify-between">
<tm-button <div class="flex flex-col">
color="#46299D" <div @click="openDrawer" class="flex items-center text-[28rpx] leading-[60rpx] text-[#000000] font-bold">
disabled="true" <div>已选择部门数</div>
disabledColor="#E6E6E6" <div>{{ allCheckedList.length }}</div>
:margin="[0]" <div class="ml-[28rpx]">
:shadow="0" <tm-icon :fontSize="24" color="#46299D" name="tmicon-angle-up"></tm-icon>
:width="426" </div>
:height="76" </div>
size="large" <div class="text-[24rpx] leading-[24rpx] text-[#7A58DE] w-[280rpx] truncate">
label="确定" {{ allCheckedList.map(v=>v.name).toString() }}
> </div>
</tm-button> </div>
<div class="btnBox">
<tm-button
@click="handleConfirm"
color="#46299D"
:disabled="!allCheckedList.length"
disabledColor="#E6E6E6"
:margin="[0]"
:shadow="0"
:width="264"
:height="76"
size="large"
label="确定"
>
</tm-button>
</div>
</div> </div>
</div> </div>
</div> </div>
<tm-drawer
placement="bottom"
v-model:show="showWin"
:height="800"
:hideHeader="true"
:round="5"
>
<div class="flex flex-col w-full h-full pt-[36rpx] pl-[32rpx] pr-[32rpx] leading-[60rpx]" >
<div class="text-[32rpx] font-bold flex items-center justify-between" >
<div class="flex items-center ml-[10rpx]">
<div>已选择部门数</div>
<div>{{ allCheckedList.length }}</div>
</div>
<div
class="text-[#7A58DE] mr-[10rpx]"
@click="()=>showWin = false"
>
确定
</div>
</div>
<div class="flex-1 pb-[20rpx] overflow-y-auto pt-[30rpx]" >
<div
v-for="(item,index) in allCheckedList"
class="flex flex-col"
>
<div v-if="index ===0" class="divider" ></div>
<div
class="flex items-center justify-between mt-[36rpx] font-bold text-[#000000] leading-[54rpx] mb-[34rpx]"
>
<div class="text-[28rpx] ml-[10rpx]">{{ item.name }}</div>
<div class="diyBtn">
<tm-button @click="()=>deleteNode(item)" :disabled="userDepIds.includes(item.ID)" :margin="[10]" :shadow="0" text size="small" :width="106" :height="50" outlined label="移除"></tm-button>
</div>
</div>
<div class="divider" ></div>
</div>
</div>
</div>
</tm-drawer>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -142,11 +196,35 @@ const {
depTreeMyList, depTreeMyList,
crumbs, crumbs,
crumbsIndex, crumbsIndex,
onChoosenDeps, depCheckedKeys,
} = useGroupTypeStore(); } = useGroupTypeStore();
const userStore = useUserStore()
const searchVal = ref(""); const searchVal = ref("");
const crumbsContainer = ref(null); const crumbsContainer = ref(null);
const showWin = ref(false);
const getAllCheckedNodes = (node, checkedNodes = []) => {
if (node.checkStatus === 'checked') {
checkedNodes.push(node);
}
if (node.sons && Array.isArray(node.sons)) {
node.sons.forEach(son => getAllCheckedNodes(son, checkedNodes));
}
return checkedNodes;
};
const userDepIds = computed(() => {
return userStore.deps.map(v=>v.dept_id);
});
const allCheckedList = computed(() => {
const checkedNodes = [];
depTreeMyList.value.forEach(node => getAllCheckedNodes(node, checkedNodes));
console.log("checkedNodes", checkedNodes);
return checkedNodes;
})
const currentCrumbs = computed(() => { const currentCrumbs = computed(() => {
if (crumbs.value[crumbsIndex.value] ) { if (crumbs.value[crumbsIndex.value] ) {
@ -159,11 +237,30 @@ const currentCrumbs = computed(() => {
sons: filterSons, sons: filterSons,
}; };
} }
console.log("allCheckedList", crumbs.value[crumbsIndex.value]);
return crumbs.value[crumbsIndex.value]; return crumbs.value[crumbsIndex.value];
} }
return {} return {}
}); });
const allCheckStatus = computed(() => {
if (!currentCrumbs.value.sons) {
return "noChecked";
}
const allChecked = currentCrumbs.value.sons.every((son) => son.checkStatus === "checked");
const someChecked =currentCrumbs.value.sons.some(
(son) =>
son.checkStatus === "checked" || son.checkStatus === "halfChecked"
);
if (allChecked) {
return "checked";
} else if (someChecked) {
return "halfChecked";
} else {
return "noChecked";
}
})
const findNodeById = (node, targetId) => { const findNodeById = (node, targetId) => {
if (node.ID === targetId) { if (node.ID === targetId) {
return node; return node;
@ -197,28 +294,44 @@ const findParentNode = (node, targetId) => {
const updateParentStatus = (node) => { const updateParentStatus = (node) => {
const parent = findParentNode(depTreeMyList.value[0], node.ID); const parent = findParentNode(depTreeMyList.value[0], node.ID);
if (!parent) return; if (!parent) return;
const allChecked = if (parent.checkStatus !== "checked"){
parent.sons && const allChecked =
Array.isArray(parent.sons) && parent.sons &&
parent.sons.every((son) => son.checkStatus === "checked"); Array.isArray(parent.sons) &&
const someChecked = parent.sons.every((son) => son.checkStatus === "checked");
parent.sons && const someChecked =
Array.isArray(parent.sons) && parent.sons &&
parent.sons.some( Array.isArray(parent.sons) &&
(son) => parent.sons.some(
son.checkStatus === "checked" || son.checkStatus === "halfChecked" (son) =>
); son.checkStatus === "checked" || son.checkStatus === "halfChecked"
);
if (allChecked) {
parent.checkStatus = "checked"; if (allChecked) {
} else if (someChecked) { parent.checkStatus = "halfChecked";
parent.checkStatus = "halfChecked"; } else if (someChecked) {
} else { parent.checkStatus = "halfChecked";
parent.checkStatus = "noChecked"; } else {
parent.checkStatus = "noChecked";
}
} }
updateParentStatus(parent); updateParentStatus(parent);
}; };
//
const updateNodeStatus = (node) => {
if (!node.sons || !Array.isArray(node.sons)) return;
const allChecked = node.sons.every(son => son.checkStatus === 'checked');
const someChecked = node.sons.some(son => son.checkStatus === 'checked' || son.checkStatus === 'halfChecked');
if (allChecked) {
node.checkStatus = 'halfChecked';
} else if (someChecked) {
node.checkStatus = 'halfChecked';
} else {
node.checkStatus = 'noChecked';
}
};
// //
const updateCheckStatus = (node, status) => { const updateCheckStatus = (node, status) => {
@ -236,6 +349,14 @@ const checkItemChange = (item, val) => {
updateParentStatus(item); updateParentStatus(item);
}; };
const deleteNode = (item) => {
const treeNode = findNodeById(depTreeMyList.value[0], item.ID);
if (!treeNode) return;
treeNode.checkStatus = "noChecked";
updateNodeStatus(treeNode);
updateParentStatus(treeNode);
};
const toNextLevel = async (item) => { const toNextLevel = async (item) => {
if (item.checkStatus !== "checked") { if (item.checkStatus !== "checked") {
crumbs.value.push(item); crumbs.value.push(item);
@ -259,34 +380,50 @@ const allCheck = (status) => {
} else { } else {
statusT = "checked"; statusT = "checked";
} }
if (searchVal.value && searchVal.value !== "") { currentCrumbs.value.sons.forEach((item) => {
currentCrumbs.value.sons.forEach((item) => { const itemT = findNodeById(depTreeMyList.value[0], item.ID)
const itemT = findNodeById(depTreeMyList.value[0], item.ID) if (!itemT) return;
if (!itemT) return; checkItemChange(itemT, statusT);
checkItemChange(itemT, statusT); });
}); };
} else {
if (crumbs.value[crumbsIndex.value] && crumbs.value[crumbsIndex.value].sons?.length) { const openDrawer = () => {
const parent = findParentNode(depTreeMyList.value[0], crumbs.value[crumbsIndex.value].sons[0].ID); showWin.value = true;
if (!parent) return; if (allCheckedList.length>0) {
checkItemChange(parent, statusT ==='checked' ? "checked":"noChecked");
}
} }
}; };
watch(() => depTreeMyList.value, (newValue, oldValue) => { // watch(() => depTreeMyList.value, (newValue, oldValue) => {
console.log("depTreeMyList", newValue); // console.log("depTreeMyList", newValue);
}, { deep: true }); // }, { deep: true });
watch(() => searchVal.value, (newValue, oldValue) => { // watch(() => searchVal.value, (newValue, oldValue) => {
console.log("searchVal", newValue); // console.log("searchVal", newValue);
}); // });
const handleConfirm = () => {
depCheckedKeys.value = lodash.cloneDeep(allCheckedList.value)
console.log("depCheckedKeys", depCheckedKeys.value);
uni.navigateBack();
}
const initCheckedKeys = () => {
depCheckedKeys.value.forEach((item) => {
const node = findNodeById(depTreeMyList.value[0], item.ID);
if (node) {
node.checkStatus = "checked";
updateParentStatus(node);
}
});
};
const init = async () => { const init = async () => {
crumbsIndex.value = 0; crumbsIndex.value = 0;
await getDepsTreeMy(); await getDepsTreeMy();
crumbs.value = depTreeMyList.value.length ? [depTreeMyList.value[0]] : []; crumbs.value = depTreeMyList.value.length ? [depTreeMyList.value[0]] : [];
initCheckedKeys();
}; };
onMounted(() => { onMounted(() => {
@ -317,8 +454,8 @@ page {
} }
.divider { .divider {
height: 1rpx; height: 1rpx;
background-color: #7c7c7c; background-color: #707070;
opacity: 0.6; opacity: 0.1;
} }
.vDivider { .vDivider {
width: 1rpx; width: 1rpx;
@ -368,4 +505,16 @@ page {
.no-scrollbar::-webkit-scrollbar { .no-scrollbar::-webkit-scrollbar {
display: none; /* Chrome, Safari, and Opera */ display: none; /* Chrome, Safari, and Opera */
} }
.diyBtn {
:deep(uni-button) {
color: #191919 !important;
border: 1rpx solid #D6D6D8 !important;
background-color: #FFFFFF !important;
&[disabled="true"] {
color: #BEBEBE !important;
border: 1rpx solid #E6E6E6 !important;
background-color: #E6E6E6 !important;
}
}
}
</style> </style>

View File

@ -0,0 +1,532 @@
<template>
<div class="outer-layer">
<div>
<tm-navbar :hideBack="false" hideHome title="群管理员"> </tm-navbar>
</div>
<div class="root">
<div
class="w-full h-[1134rpx] mb-[20rpx] pl-[32rpx] pr-[32rpx] pb-[20rpx] overflow-y-auto"
>
<div class="pl-[16rpx] pr-[16rpx] pt-[22rpx] pb-[24rpx] bg-[#FFFFFF]">
<tm-input
placeholder="请输入…"
color="#F9F9FD"
:round="1"
prefix="tmicon-search"
prefixColor="#46299D"
searchBgColor="#F9F9FD"
focusColor="#F9F9FD"
v-model="searchVal"
></tm-input>
<div
v-if="crumbs.length"
class="w-full overflow-x-auto mt-[22rpx] leading-[48rpx] text-[#2F2F2F] flex items-center no-scrollbar"
ref="crumbsContainer"
>
<div
v-for="(item, index) in crumbs"
class="flex items-center text-[28rpx] leading-[48rpx] whitespace-nowrap"
:class="[
index === crumbsIndex ? 'text-[#747474]' : 'text-[#46299D]',
index === 0 ? '' : 'ml-[12rpx]',
]"
@click="handleCrumbsClick(index)"
>
<div>{{ item.name }}</div>
<div
v-if="index !== crumbs.length - 1"
class="ml-[20rpx] flex items-center mb-[2rpx]"
>
<tm-icon
name="tmicon-angle-right"
:font-size="20"
:color="index !== crumbs.length - 1 ? '#7A58DE' : '#C1B4EA'"
></tm-icon>
</div>
</div>
</div>
</div>
<!-- <div
class="pl-[32rpx] bg-[#FFFFFF] mt-[20rpx] h-[110rpx] flex items-center"
@click="()=>allCheck(allCheckStatus)"
>
<div>
<checkBox
:disabled="currentCrumbs?.sons?.length === 0"
:modelValue="allCheckStatus"
></checkBox>
</div>
<div class="font-bold text-[28rpx] leading-[54rpx] ml-[20rpx]">
全选
</div>
</div> -->
<div
v-if="currentCrumbs?.sons?.length"
v-for="item in currentCrumbs?.sons"
class="pl-[32rpx] bg-[#FFFFFF] mt-[20rpx] h-[110rpx] flex items-center"
>
<div class="w-full flex items-center justify-between">
<div
class="flex items-center"
>
<div>
<!-- <checkBox
:disabled="!item?.sons?.length"
v-model="item.checkStatus"
@change="(val) => checkItemChange(item, val)"
></checkBox> -->
</div>
<div class="font-bold text-[28rpx] leading-[54rpx] ml-[20rpx]">
{{ item.name }}
</div>
</div>
<div class="flex items-center mr-[32rpx]">
<div class="vDivider mr-[32rpx]"></div>
<div @click="() => toNextLevel(item)" class="flex items-center">
<div class="mr-[12rpx]">
<tm-image
:width="26"
:height="26"
:src="item.checkStatus !== 'checked' ? downDep : downDepDis"
></tm-image>
</div>
<div
class="text-[28rpx] leading-[54rpx] font-bold"
:class="
item.checkStatus !== 'checked'
? 'text-[#46299D]'
: 'text-[#C1B4EA]'
"
>
下级
</div>
</div>
</div>
</div>
</div>
<div
v-if="currentCrumbs?.positions?.length"
v-for="item in currentCrumbs?.positions"
class="pl-[32rpx] bg-[#FFFFFF] mt-[20rpx] h-[110rpx] flex items-center"
>
<div class="w-full flex items-center justify-between">
<div
class="flex items-center"
>
<div>
<checkBox
:disabled="!item?.sons?.length"
:modelValue="choosePostList.find(v=>v.ID === item.ID)?'checked':'noChecked'"
@change="(val) => checkItemChange(item, val)"
></checkBox>
</div>
<div class="font-bold text-[28rpx] leading-[54rpx] ml-[20rpx]">
{{ item.name }}
</div>
</div>
</div>
</div>
</div>
<div class="h-[162rpx] pl-[32rpx] pr-[32rpx] bg-[#FFFFFF]">
<div class="mt-[14rpx] flex justify-between">
<div class="flex flex-col">
<div @click="openDrawer" class="flex items-center text-[28rpx] leading-[60rpx] text-[#000000] font-bold">
<div>已选择岗位数</div>
<div>{{ choosePostList.length }}</div>
<div class="ml-[28rpx]">
<tm-icon :fontSize="24" color="#46299D" name="tmicon-angle-up"></tm-icon>
</div>
</div>
<div class="text-[24rpx] leading-[24rpx] text-[#7A58DE] w-[280rpx] truncate">
{{ choosePostList.map(v=>v.name).toString() }}
</div>
</div>
<div class="btnBox">
<tm-button
@click="handleConfirm"
color="#46299D"
:disabled="!choosePostList.length"
disabledColor="#E6E6E6"
:margin="[0]"
:shadow="0"
:width="264"
:height="76"
size="large"
label="确定"
>
</tm-button>
</div>
</div>
</div>
</div>
<tm-drawer
placement="bottom"
v-model:show="showWin"
:height="800"
:hideHeader="true"
:round="5"
>
<div class="flex flex-col w-full h-full pt-[36rpx] pl-[32rpx] pr-[32rpx] leading-[60rpx]" >
<div class="text-[32rpx] font-bold flex items-center justify-between" >
<div class="flex items-center ml-[10rpx]">
<div>已选择岗位数</div>
<div>{{ choosePostList.length }}</div>
</div>
<div
class="text-[#7A58DE] mr-[10rpx]"
@click="()=>showWin = false"
>
确定
</div>
</div>
<div class="flex-1 pb-[20rpx] overflow-y-auto pt-[30rpx]" >
<div
v-for="(item,index) in choosePostList"
class="flex flex-col"
>
<div v-if="index ===0" class="divider" ></div>
<div
class="flex items-center justify-between mt-[36rpx] font-bold text-[#000000] leading-[54rpx] mb-[34rpx]"
>
<div class="text-[28rpx] ml-[10rpx]">{{ item.departmentName }}-{{ item.name }}</div>
<div class="diyBtn">
<tm-button @click="()=>deleteNode(item)" :disabled="userDepIds.includes(item.ID)" :margin="[10]" :shadow="0" text size="small" :width="106" :height="50" outlined label="移除"></tm-button>
</div>
</div>
<div class="divider" ></div>
</div>
</div>
</div>
</tm-drawer>
</div>
</template>
<script setup>
import { ref, watch, computed, onMounted,nextTick } from "vue";
import { onShow, onLoad } from "@dcloudio/uni-app";
import { useChatList } from "@/store/chatList/index.js";
import { useAuth } from "@/store/auth";
import { useTalkStore, useUserStore } from "@/store";
import { useGroupTypeStore } from "@/store/groupType";
import downDep from "@/static/image/chatList/downDep.png";
import downDepDis from "@/static/image/chatList/downDepDis.png";
import checkBox from "@/components/checkBox/index.vue";
import lodash from 'lodash'
const {
groupActiveIndex,
getPositionsTree,
postTreeList,
crumbs,
crumbsIndex,
depCheckedKeys,
groupAdmins,
} = useGroupTypeStore();
const userStore = useUserStore()
// 1 groupAdmin 2 groupMember
const pageType = ref(1);
const searchVal = ref("");
const crumbsContainer = ref(null);
const showWin = ref(false);
const choosePostList = ref([])
const getAllCheckedNodes = (node, checkedNodes = []) => {
if (node.checkStatus === 'checked') {
checkedNodes.push(node);
}
if (node.sons && Array.isArray(node.sons)) {
node.sons.forEach(son => getAllCheckedNodes(son, checkedNodes));
}
return checkedNodes;
};
const userDepIds = computed(() => {
return userStore.deps.map(v=>v.dept_id);
});
const currentCrumbs = computed(() => {
if (crumbs.value[crumbsIndex.value] ) {
if (searchVal.value && searchVal.value !== "") {
let filterSons = crumbs.value[crumbsIndex.value].sons.filter((item) =>
item.name.includes(searchVal.value)
);
return {
...crumbs.value[crumbsIndex.value],
sons: filterSons,
};
}
console.log("allCheckedList", crumbs.value[crumbsIndex.value]);
return crumbs.value[crumbsIndex.value];
}
return {}
});
// const allCheckStatus = computed(() => {
// if (!currentCrumbs.value.sons) {
// return "noChecked";
// }
// const allChecked = currentCrumbs.value.sons.every((son) => son.checkStatus === "checked");
// const someChecked =currentCrumbs.value.sons.some(
// (son) =>
// son.checkStatus === "checked" || son.checkStatus === "halfChecked"
// );
// if (allChecked) {
// return "checked";
// } else if (someChecked) {
// return "halfChecked";
// } else {
// return "noChecked";
// }
// })
const findNodeById = (node, targetId) => {
if (node.ID === targetId) {
return node;
}
if (node.sons && Array.isArray(node.sons)) {
for (const son of node.sons) {
const found = findNodeById(son, targetId);
if (found) {
return found;
}
}
}
return null;
};
const findParentNode = (node, targetId) => {
if (!node.sons || !Array.isArray(node.sons)) return null;
for (const son of node.sons) {
if (son.ID === targetId) {
return node;
}
const parent = findParentNode(son, targetId);
if (parent) {
return parent;
}
}
return null;
};
//
const updateParentStatus = (node) => {
const parent = findParentNode(postTreeList.value[0], node.ID);
if (!parent) return;
if (parent.checkStatus !== "checked"){
const allChecked =
parent.sons &&
Array.isArray(parent.sons) &&
parent.sons.every((son) => son.checkStatus === "checked");
const someChecked =
parent.sons &&
Array.isArray(parent.sons) &&
parent.sons.some(
(son) =>
son.checkStatus === "checked" || son.checkStatus === "halfChecked"
);
if (allChecked) {
parent.checkStatus = "halfChecked";
} else if (someChecked) {
parent.checkStatus = "halfChecked";
} else {
parent.checkStatus = "noChecked";
}
}
updateParentStatus(parent);
};
//
const updateNodeStatus = (node) => {
if (!node.sons || !Array.isArray(node.sons)) return;
const allChecked = node.sons.every(son => son.checkStatus === 'checked');
const someChecked = node.sons.some(son => son.checkStatus === 'checked' || son.checkStatus === 'halfChecked');
if (allChecked) {
node.checkStatus = 'halfChecked';
} else if (someChecked) {
node.checkStatus = 'halfChecked';
} else {
node.checkStatus = 'noChecked';
}
};
//
const updateCheckStatus = (node, status) => {
node.checkStatus = status;
if (node.sons && Array.isArray(node.sons) && node.sons.length > 0) {
node.sons.forEach((son) => updateCheckStatus(son, status));
}
};
const checkItemChange = (item, val) => {
if (val === 'checked') {
let depItem = findNodeById(postTreeList.value[0],item.departmentID)
choosePostList.value.push({
...item,
departmentName:depItem.name,
})
}else{
choosePostList.value = choosePostList.value.filter(v=>v.ID !== item.ID)
}
};
const deleteNode = (item) => {
choosePostList.value = choosePostList.value.filter(v=>v.ID !== item.ID)
};
const toNextLevel = async (item) => {
if (item.checkStatus !== "checked") {
crumbs.value.push(item);
crumbsIndex.value++;
await nextTick();
if (crumbsContainer.value) {
crumbsContainer.value.scrollLeft = crumbsContainer.value.scrollWidth;
}
}
};
const handleCrumbsClick = (index) => {
crumbsIndex.value = index;
crumbs.value = crumbs.value.slice(0, index + 1);
};
// const allCheck = (status) => {
// let statusT = 'noChecked';
// if (status === "checked") {
// statusT = "noChecked";
// } else {
// statusT = "checked";
// }
// currentCrumbs.value.sons.forEach((item) => {
// const itemT = findNodeById(postTreeList.value[0], item.ID)
// if (!itemT) return;
// checkItemChange(itemT, statusT);
// });
// };
const openDrawer = () => {
showWin.value = true;
if (allCheckedList.length>0) {
}
};
watch(() => postTreeList.value, (newValue, oldValue) => {
console.log("postTreeList", newValue);
}, { deep: true });
// watch(() => searchVal.value, (newValue, oldValue) => {
// console.log("searchVal", newValue);
// });
const handleConfirm = () => {
groupAdmins.value = lodash.cloneDeep(choosePostList.value)
console.log("groupAdmins", groupAdmins.value);
uni.navigateBack();
}
const initCheckedKeys = () => {
choosePostList.value = groupAdmins.value
};
const init = async () => {
crumbsIndex.value = 0;
await getPositionsTree();
crumbs.value = postTreeList.value.length ? [postTreeList.value[0]] : [];
initCheckedKeys();
};
onMounted(() => {
init();
});
</script>
<style scoped lang="scss">
uni-page-body,
page {
height: 100%;
}
.outer-layer {
overflow-y: auto;
flex: 1;
background-image: url("@/static/image/clockIn/z3280@3x.png");
background-size: cover;
padding-bottom: 0;
display: flex;
flex-direction: column;
}
.root {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding-top: 18rpx;
overflow: hidden;
}
.divider {
height: 1rpx;
background-color: #707070;
opacity: 0.1;
}
.vDivider {
width: 1rpx;
height: 48rpx;
background-color: #b4b4b4;
}
.avatar-placeholder {
width: 192rpx;
height: 192rpx;
background-color: #e0e0e0;
border-radius: 50%;
margin-bottom: 40rpx;
}
.groupCard {
height: 272rpx;
width: 100%;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
border-radius: 12rpx;
&.firstPanel {
background-image: url("@/static/image/chatList/zu6033@2x.png");
}
&.secondPanel {
background-image: url("@/static/image/chatList/zu6031@2x.png");
margin-top: 28rpx;
margin-bottom: 28rpx;
}
&.thirdPanel {
background-image: url("@/static/image/chatList/zu6032@2x.png");
}
&.activePanel {
box-shadow: 0 0 0 3rpx #46299d;
}
}
.btnBox {
:deep(uni-button[disabled="true"]) {
color: #bebebe !important;
}
}
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.no-scrollbar::-webkit-scrollbar {
display: none; /* Chrome, Safari, and Opera */
}
.diyBtn {
:deep(uni-button) {
color: #191919 !important;
border: 1rpx solid #D6D6D8 !important;
background-color: #FFFFFF !important;
&[disabled="true"] {
color: #BEBEBE !important;
border: 1rpx solid #E6E6E6 !important;
background-color: #E6E6E6 !important;
}
}
}
</style>

View File

@ -26,7 +26,7 @@
</div> </div>
</div> </div>
<div @click="groupActiveIndex = 1" class="groupCard secondPanel" :class="groupActiveIndex === 1?'activePanel':''"> <div @click="groupActiveIndex = 1" class="groupCard secondPanel" :class="groupActiveIndex === 1?'activePanel':''">
<div class="w-full h-full pt-[48rpx] pr-[36rpx] flex flex-col items-end"> <div class="w-full h-full pr-[36rpx] flex flex-col items-end justify-center">
<div class="text-[36rpx] leading-[54rpx] text-[#2F2F2F] font-bold" > <div class="text-[36rpx] leading-[54rpx] text-[#2F2F2F] font-bold" >
部门群 部门群
</div> </div>
@ -34,12 +34,23 @@
指定部门员工入职自动进群 指定部门员工入职自动进群
离职后自动退群 离职后自动退群
</div> </div>
<div @click="chooseDep" class="text-[24rpx] leading-[36rpx] text-[#C1B4EA] flex items-center mt-[16rpx]" > <div v-if="!depCheckedKeys.length" @click="chooseDep" class="text-[24rpx] leading-[36rpx] text-[#C1B4EA] flex items-center mt-[16rpx]" >
<div :class="groupActiveIndex === 1?'text-[#7A58DE]':'text-[#C1B4EA]'" >选择部门</div> <div :class="groupActiveIndex === 1?'text-[#7A58DE]':'text-[#C1B4EA]'" >选择部门</div>
<div class="ml-[20rpx]"> <div class="ml-[20rpx]">
<tm-icon name="tmicon-angle-right" :font-size="18" :color="groupActiveIndex === 1?'#7A58DE':'#C1B4EA'"></tm-icon> <tm-icon name="tmicon-angle-right" :font-size="18" :color="groupActiveIndex === 1?'#7A58DE':'#C1B4EA'"></tm-icon>
</div> </div>
</div> </div>
<div v-else class="text-[24rpx] leading-[36rpx] flex flex-col justify-center items-end mt-[16rpx] mb-[22rpx]" >
<div class="max-w-[336rpx] truncate" >
{{ depCheckedKeys.map(v=>v.name).toString() }}
</div>
<div @click="chooseDep" class="flex items-center" >
<div class="text-[#7A58DE]" >查看全部</div>
<div class="ml-[20rpx]">
<tm-icon name="tmicon-angle-right" :font-size="18" :color="groupActiveIndex === 1?'#7A58DE':'#C1B4EA'"></tm-icon>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div @click="groupActiveIndex = 2" class="groupCard thirdPanel" :class="groupActiveIndex === 2?'activePanel':''"> <div @click="groupActiveIndex = 2" class="groupCard thirdPanel" :class="groupActiveIndex === 2?'activePanel':''">
@ -59,8 +70,9 @@
<div class="h-[162rpx] flex justify-center bg-[#FFFFFF]"> <div class="h-[162rpx] flex justify-center bg-[#FFFFFF]">
<div class="mt-[14rpx] btnBox" > <div class="mt-[14rpx] btnBox" >
<tm-button <tm-button
@click="handleConfirm"
color="#46299D" color="#46299D"
disabled="true" :disabled="confirmBtnStatus"
disabledColor="#E6E6E6" disabledColor="#E6E6E6"
:margin="[0]" :margin="[0]"
:shadow="0" :shadow="0"
@ -83,8 +95,25 @@ import { useAuth } from "@/store/auth";
import { useTalkStore, useUserStore } from "@/store"; import { useTalkStore, useUserStore } from "@/store";
import { useGroupTypeStore } from "@/store/groupType"; import { useGroupTypeStore } from "@/store/groupType";
const { groupActiveIndex } = useGroupTypeStore(); const { groupActiveIndex,depCheckedKeys } = useGroupTypeStore();
const confirmBtnStatus = computed(() => {
let disabledT = false;
switch (groupActiveIndex.value) {
case 0:
break;
case 1:
if (!depCheckedKeys.value.length) {
disabledT = true;
}
break;
case 2:
break;
default:
break;
}
return disabledT
})
const chooseDep = () => { const chooseDep = () => {
uni.navigateTo({ uni.navigateTo({
@ -92,6 +121,13 @@ const chooseDep = () => {
}); });
}; };
const handleConfirm = () => {
uni.navigateBack()
// uni.navigateTo({
// url: '/pages/creatGroupChat/index'
// });
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
uni-page-body, uni-page-body,

View File

@ -5,9 +5,9 @@
</tm-navbar> </tm-navbar>
</div> </div>
<div class="root"> <div class="root">
<div class="w-full pl-[32rpx] pr-[32rpx]" > <div class="w-full pl-[32rpx] pr-[32rpx] mb-[20rpx]" >
<div class="w-full mt-[60rpx] flex justify-center" > <div class="w-full mt-[60rpx] flex justify-center" >
<div v-if="!groupChatType" class="avatar-placeholder"> <div v-if="groupActiveIndex === -1" class="avatar-placeholder">
</div> </div>
<div class="mb-[40rpx]" v-else> <div class="mb-[40rpx]" v-else>
@ -19,51 +19,108 @@
></tm-image> ></tm-image>
</div> </div>
</div> </div>
<div class="input-group"> <div class="input-group flex items-center justify-between" >
<div class="input-item"> <div class="input-item">
群名称 群名称
</div> </div>
<div class="input-box" > <div class="input-box" >
<tm-input <tm-input
v-model="groupName"
:followTheme="false" :followTheme="false"
color="#fff" fontColor="#747474"
placeholderStyle="color: #B4B4B4" placeholderStyle="color: #B4B4B4"
focusColor="#FFF" focusColor="#FFF"
:fontSize="28" :fontSize="28"
:maxlength="20" :maxlength="20"
:height="40"
:transprent="true" :transprent="true"
placeholder="请输入群名称1~20个字" placeholder="请输入群名称1~20个字"
:padding="[0]" :padding="[0,0]"
align="right"
> >
</tm-input> </tm-input>
</div> </div>
</div> </div>
<div class="input-group mt-[20rpx]"> <div class="input-group w-full flex flex-col mt-[20rpx] leading-[40rpx]" >
<div class="input-item"> <div class="flex items-center justify-between" >
群类型 <div class="input-item">
</div> 群类型
<div @click="chooseGroupType" class="left-box" >
<div class="text-[#B4B4B4] text-[28rpx]" >
请选择群类型
</div> </div>
<div class="ml-[32rpx]" > <div @click="chooseGroupType" class="left-box" >
<tm-icon :font-size="22" color="#747474" name="tmicon-angle-right"></tm-icon> <div class="text-[#B4B4B4] text-[28rpx]" >
<span v-if="groupActiveIndex ===-1">请选择群类型</span>
<span v-else-if="groupActiveIndex ===0">普通群</span>
<span v-else-if="groupActiveIndex ===1">部门群</span>
<span v-else-if="groupActiveIndex ===2">项目群</span>
</div>
<div class="ml-[32rpx]" >
<tm-icon :font-size="22" color="#747474" name="tmicon-angle-right"></tm-icon>
</div>
</div>
</div>
<div v-if="depCheckedKeys.length" class="mt-[32rpx]" >
<div
v-for="(item,index) in depCheckedKeys"
class="text-[#747474] text-[28rpx] leading-[40rpx] font-bold"
:class="[
index !==0 ? 'mt-[10rpx]':'',
depsNoExpanded&&index>4 ? 'hidden':''
]"
>
{{ item.name }}
</div>
<div class="text-[#46299D] text-[28rpx] mt-[20rpx] font-bold flex justify-center" >
<div v-if="depCheckedKeys.length>5" @click="depsNoExpanded = !depsNoExpanded" class="w-[100rpx]">
{{ depsNoExpanded? '展开':'收起' }}
</div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="groupActiveIndex===1" class="input-group w-full flex flex-col mt-[20rpx] leading-[40rpx]" >
<div class="flex items-center justify-between" >
<div class="input-item">
群管理员
</div>
<div @click="chooseGroupAdmin" class="left-box" >
<div class="ml-[32rpx] flex items-center" >
<div v-if="!groupAdmins.length" class="text-[#B4B4B4] text-[28rpx] font-bold mr-[32rpx]">请选择群管理员</div>
<tm-icon :font-size="22" color="#747474" name="tmicon-angle-right"></tm-icon>
</div>
</div>
</div>
<div v-if="groupAdmins.length" class="mt-[32rpx]" >
<div
v-for="(item,index) in groupAdmins"
class="text-[#747474] text-[28rpx] leading-[40rpx] font-bold"
:class="[
index !==0 ? 'mt-[10rpx]':'',
depsNoExpanded&&index>4 ? 'hidden':''
]"
>
{{ item.name }}
</div>
<div class="text-[#46299D] text-[28rpx] mt-[20rpx] font-bold flex justify-center" >
<div v-if="groupAdmins.length>5" @click="depsNoExpanded = !depsNoExpanded" class="w-[100rpx]">
{{ depsNoExpanded? '展开':'收起' }}
</div>
</div>
</div>
</div>
</div> </div>
<div class="h-[162rpx] flex justify-center bg-[#FFFFFF]"> <div class="h-[162rpx] flex justify-center bg-[#FFFFFF]">
<div class="mt-[14rpx]" > <div class="mt-[14rpx] btnBox" >
<tm-button <tm-button
@click="handleConfirm"
color="#46299D" color="#46299D"
disabled="true" :disabled="confirmBtnStatus"
disabledColor="#E6E6E6" disabledColor="#E6E6E6"
:margin="[0]" :margin="[0]"
:shadow="0" :shadow="0"
:width="426" :width="426"
:height="76" :height="76"
size="large" size="large"
label="按钮" label="发起群聊"
> >
</tm-button> </tm-button>
</div> </div>
@ -82,26 +139,28 @@ import cahtPopover from "@/static/image/chatList/cahtPopover.png";
import zu4992 from "@/static/image/chatList/zu4992@2x.png"; import zu4992 from "@/static/image/chatList/zu4992@2x.png";
import zu4991 from "@/static/image/chatList/zu4991@2x.png"; import zu4991 from "@/static/image/chatList/zu4991@2x.png";
import zu4989 from "@/static/image/chatList/zu4989@2x.png"; import zu4989 from "@/static/image/chatList/zu4989@2x.png";
import { useGroupTypeStore } from "@/store/groupType";
const { groupName,groupActiveIndex,depCheckedKeys,groupAdmins,createDepGroup,resetGroupInfo } = useGroupTypeStore();
const talkStore = useTalkStore(); const talkStore = useTalkStore();
const userStore = useUserStore(); const userStore = useUserStore();
const { userInfo } = useAuth(); const { userInfo } = useAuth();
const groupChatName = ref("");
const groupChatType = ref(''); const groupChatType = ref('');
const depsNoExpanded = ref(true);
const avatarImg = computed(() => { const avatarImg = computed(() => {
let srcT = ""; let srcT = "";
switch (groupChatType.value) { switch (groupActiveIndex.value) {
case '普通群': case 0:
srcT = zu4992; srcT = zu4992;
break; break;
case '项目群': case 1:
srcT = zu4991;
break;
case '部门群':
srcT = zu4989; srcT = zu4989;
break; break;
case 2:
srcT = zu4991;
break;
default: default:
srcT = zu4992; srcT = zu4992;
} }
@ -114,6 +173,55 @@ const chooseGroupType = () => {
}) })
} }
const chooseGroupAdmin = () => {
uni.navigateTo({
url: '/pages/chooseGroupAdmin/index'
})
}
const handleConfirm = async () => {
if (groupActiveIndex.value === 0) {
}else if(groupActiveIndex.value === 1){
const res = await createDepGroup()
if (res.code === 200) {
resetGroupInfo()
uni.navigateBack()
}
}else {
}
}
const confirmBtnStatus = computed(() => {
let disabledT = false;
if (groupName.value === "" || !groupActiveIndex.value) {
return true;
}
switch (groupActiveIndex.value) {
case 0:
break;
case 1:
if (!depCheckedKeys.value.length) {
disabledT = true;
}
if (!groupAdmins.value.length) {
disabledT = true;
}
break;
case 2:
break;
default:
break;
}
return disabledT
})
onShow(() => {
depsNoExpanded.value = true;
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -149,27 +257,34 @@ page {
margin-bottom: 40rpx; margin-bottom: 40rpx;
} }
.input-group { .input-group {
height: 110rpx;
background-color: #fff; background-color: #fff;
padding-top: 38rpx;
padding-bottom: 32rpx;
padding-left: 32rpx; padding-left: 32rpx;
padding-right: 40rpx; padding-right: 40rpx;
display: flex; // display: flex;
align-items: center; // align-items: center;
// justify-content: space-between;
} }
.input-item { .input-item {
line-height: 54rpx; line-height: 40rpx;
font-size: 28rpx; font-size: 28rpx;
color: #000; color: #000;
font-weight: bold; font-weight: bold;
} }
.input-box { .input-box {
margin-left: 84rpx; margin-left: 84rpx;
line-height: 40rpx;
width: 404rpx; width: 404rpx;
} }
.left-box { .left-box {
margin-left: 290rpx;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.btnBox {
:deep(uni-button[disabled="true"]) {
color: #bebebe !important;
}
}
</style> </style>

View File

@ -1,10 +1,11 @@
import {createGlobalState,useStorage} from '@vueuse/core' import {createGlobalState,useStorage} from '@vueuse/core'
import {uniStorage} from "@/utils/uniStorage.js" import {uniStorage} from "@/utils/uniStorage.js"
import { userInfoApi } from "@/api/user";
import {ref} from 'vue' import {ref} from 'vue'
export const useAuth = createGlobalState(() => { export const useAuth = createGlobalState(() => {
// const token = useStorage('token', '', uniStorage) // const token = useStorage('token', '', uniStorage)
const token = ref('79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941ca1430937103230a1e32a1715f569f3efdbe6f8cb8b7b8642bd679668081b9b08f693d1b5be6002d936ec51e1e3e0c4927de9e32ac99a109b326e5d2bda27ec87624bb416ec70d2a95a2e190feeba9f0d6bae8571b3dfe89c824712344759a8f2bff9d70747c52525cf6a5614f9c770bca461a9b9c247b6dca97bcf83bbaf99bb726752c4fe1e9a4aa7de5c4cf3e88a3e480801280d45cdc124f9d8221105d8529c7c268c1251c3477bff5c051043bf980aeac85434ccb1cebe1e9f4e069aeab4e7218dd08b25d2c7a248688eacf5337b097fe8e841ea8fa3ac1563adc6d41200a4ab1d210a428141915919cd9d74796e80000b9d024850015b8f7defce2919e15') const token = ref('79b5c732d96d2b27a48a99dfd4a5566c43aaa5796242e854ebe3ffc198d6876b9628e7b764d9af65ab5dbb2d517ced88170491b74b048c0ba827c0d3741462cb89dc59ed46653a449af837a8262941ca1430937103230a1e32a1715f569f3efdbe6f8cb8b7b8642bd679668081b9b08f693d1b5be6002d936ec51e1e3e0c4927de9e32ac99a109b326e5d2bda27ec87624bb416ec70d2a95a2e190feeba9f0d6bae8571b3dfe89c824712344759a8f2bff9d70747c52525cf6a5614f9c770bca461a9b9c247b6dca97bcf83bbaf99bb726752c4fe1e9a4aa7de5c4cf3e88a3e480801280d45cdc124f9d8221105d8529c7c268c1251c3477bff5c051043bf9804c4f7096c5178cc01261bbedf04108b969333baf0bd5226c426de3591fc50b70691f2a5e275fa67ea3a7301df448929c13e4b71bf2182b6bfc270e21c142aa693844a0a175637f907e4438786a6e5e50')
const refreshToken = useStorage('refreshToken', '', uniStorage) const refreshToken = useStorage('refreshToken', '', uniStorage)
const userInfo = useStorage('userInfo', {}, uniStorage) const userInfo = useStorage('userInfo', {}, uniStorage)
const leaderList = useStorage('leaderList', [], uniStorage) const leaderList = useStorage('leaderList', [], uniStorage)
@ -20,25 +21,25 @@ export const useAuth = createGlobalState(() => {
userInfo.value=res.data userInfo.value=res.data
} }
} }
const getUserLeader=async ()=>{ // const getUserLeader=async ()=>{
const data={ // const data={
departmentId:userInfo.value.PositionUsers?.map(x=>x.DepartmentId) // departmentId:userInfo.value.PositionUsers?.map(x=>x.DepartmentId)
} // }
const res= await userLeaderApi(data) // const res= await userLeaderApi(data)
if (res.status===0){ // if (res.status===0){
isLeader.value=!!res.data.departmentLeaders?.find((x) => { // isLeader.value=!!res.data.departmentLeaders?.find((x) => {
return x.userID === userInfo.value.ID // return x.userID === userInfo.value.ID
}) // })
leaderList.value=res.data.departmentLeaders // leaderList.value=res.data.departmentLeaders
myCompany.value=res.data.company // myCompany.value=res.data.company
} // }
} // }
return { return {
leaderList, leaderList,
myCompany, myCompany,
getUserLeader, // getUserLeader,
getUserInfo, getUserInfo,
userInfo, userInfo,
token, token,

View File

@ -5,14 +5,18 @@ import lodash from 'lodash'
import {ref} from 'vue' import {ref} from 'vue'
import {createGlobalState,useStorage} from '@vueuse/core' import {createGlobalState,useStorage} from '@vueuse/core'
import {uniStorage} from "@/utils/uniStorage.js" import {uniStorage} from "@/utils/uniStorage.js"
import {departmentV2TreeMy} from '@/api/deps/index.js' import {departmentV2TreeMy,departmentV2AllPosition,groupCreateDept} from '@/api/deps/index.js'
export const useGroupTypeStore = createGlobalState(() => { export const useGroupTypeStore = createGlobalState(() => {
const groupName = ref('')
const groupActiveIndex = ref(-1) // 当前激活的分组索引
const depTreeMyList = ref([]) const depTreeMyList = ref([])
const postTreeList = ref([])
const crumbs = ref([]) const crumbs = ref([])
const crumbsIndex = ref(0) const crumbsIndex = ref(0)
const onChoosenDeps = ref([]) const depCheckedKeys = ref([]) // 选中的部门keys
// const checkedKeys = ref([]) const groupAdmins = ref([]) // 选中的管理员
// const halfCheckedKeys = ref([]) // const halfCheckedKeys = ref([])
const getDepsTreeMy= async()=>{ const getDepsTreeMy= async()=>{
@ -22,13 +26,56 @@ export const useGroupTypeStore = createGlobalState(() => {
} }
} }
const getPositionsTree= async()=>{
const res = await departmentV2AllPosition()
if(res.status===0){
postTreeList.value = res.data.nodes
}
}
const resetGroupInfo = () => {
groupName.value = '';
groupActiveIndex.value = -1;
depTreeMyList.value = [];
postTreeList.value = [];
crumbs.value = [];
crumbsIndex.value = 0
depCheckedKeys.value = []
groupAdmins.value = []
}
const createDepGroup = async (param) => {
const res = await groupCreateDept({
name:groupName.value,
deptInfos:depCheckedKeys.value.map(v=>{
return {
dept_id:v.ID,
dept_name:v.name
}
}),
positionInfos:groupAdmins.value.map(v=>{
return {
position_id:v.ID,
position_name:v.name
}
})
})
return res;
}
return { return {
groupName,
groupActiveIndex,
depTreeMyList, depTreeMyList,
postTreeList,
getDepsTreeMy, getDepsTreeMy,
getPositionsTree,
crumbs, crumbs,
crumbsIndex, crumbsIndex,
onChoosenDeps depCheckedKeys,
groupAdmins,
resetGroupInfo,
createDepGroup,
} }
}) })

View File

@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
import { ServeGetUserSetting } from '@/api/user/index.js' import { ServeGetUserSetting } from '@/api/user/index.js'
// import { ServeFindFriendApplyNum } from '@/api/contact' // import { ServeFindFriendApplyNum } from '@/api/contact'
import { ServeGroupApplyUnread } from '@/api/group' import { ServeGroupApplyUnread } from '@/api/group'
import {useAuth} from '@/store/auth'
// import { delAccessToken } from '@/utils/auth' // import { delAccessToken } from '@/utils/auth'
// import { storage } from '@/utils/storage' // import { storage } from '@/utils/storage'
@ -20,7 +21,9 @@ export const useUserStore = defineStore('chatUser', {
online: false, // 在线状态 online: false, // 在线状态
isQiye: false, isQiye: false,
isContactApply: false, isContactApply: false,
isGroupApply: false isGroupApply: false,
deps:[],
positions:[],
} }
}, },
getters: {}, getters: {},
@ -40,6 +43,9 @@ export const useUserStore = defineStore('chatUser', {
loadSetting() { loadSetting() {
ServeGetUserSetting().then(({ code, data }) => { ServeGetUserSetting().then(({ code, data }) => {
if (code == 200) { if (code == 200) {
const {getUserInfo,userInfo} = useAuth()
userInfo.value.ID = data.user_info.erp_user_id
getUserInfo()
this.nickname = data.user_info.nickname this.nickname = data.user_info.nickname
this.uid = data.user_info.uid this.uid = data.user_info.uid
this.avatar = data.user_info.avatar this.avatar = data.user_info.avatar
@ -49,6 +55,8 @@ export const useUserStore = defineStore('chatUser', {
this.email = data.user_info.email || '' this.email = data.user_info.email || ''
this.motto = data.user_info.motto this.motto = data.user_info.motto
this.isQiye = data.user_info.is_qiye || false this.isQiye = data.user_info.is_qiye || false
this.deps = data.user_info.user_depts || []
this.positions = data.user_info.user_positions || []
// storage.set('user_info', data) // storage.set('user_info', data)
} }