|
|
|
@ -1,92 +1,92 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { computed, inject, onMounted, ref } from "vue";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
import { useUser } from "@/store/modules/user";
|
|
|
|
|
import { getImgUrl } from "@/utils/urlUtils";
|
|
|
|
|
import defaultAvatar from '@/assets/icons/avatar.svg';
|
|
|
|
|
import { computed, inject, onMounted, ref } from 'vue'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
|
import { getImgUrl } from '@/utils/urlUtils'
|
|
|
|
|
import defaultAvatar from '@/assets/icons/avatar.svg'
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
(e: "logout"): void;
|
|
|
|
|
}>();
|
|
|
|
|
(e: 'logout'): void
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
|
|
const userStore = useUser();
|
|
|
|
|
const userStore = useUser()
|
|
|
|
|
|
|
|
|
|
const useInfo = userStore.getUserInfo;
|
|
|
|
|
const useInfo = userStore.getUserInfo
|
|
|
|
|
|
|
|
|
|
const aiDisabled = ref(false);
|
|
|
|
|
const aiDisabled = ref(false)
|
|
|
|
|
|
|
|
|
|
function handleSelect(row) {
|
|
|
|
|
userStore.updateTenantId(row.key);
|
|
|
|
|
location.reload();
|
|
|
|
|
userStore.updateTenantId(row.key)
|
|
|
|
|
location.reload()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logIt(e) {
|
|
|
|
|
return false;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 一键查看
|
|
|
|
|
function goHome(e) {
|
|
|
|
|
router.push({ name: "home" });
|
|
|
|
|
router.push({ name: 'home' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 任务审批
|
|
|
|
|
function goTask(e) {
|
|
|
|
|
router.push({ name: "task-main" });
|
|
|
|
|
router.push({ name: 'task-main' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AI工单
|
|
|
|
|
function goWorksheet(e) {
|
|
|
|
|
router.push({ name: "worksheet-main" });
|
|
|
|
|
router.push({ name: 'worksheet-main' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 任务终审
|
|
|
|
|
function goFinal(e) {
|
|
|
|
|
router.push({ name: "final-main" });
|
|
|
|
|
router.push({ name: 'final-main' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const mousetrap = inject("mousetrap") as any;
|
|
|
|
|
const mousetrap = inject('mousetrap') as any
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
mousetrap.bind("g h", goHome);
|
|
|
|
|
mousetrap.bind("g t", goTask);
|
|
|
|
|
mousetrap.bind("g a", goWorksheet);
|
|
|
|
|
mousetrap.bind("g e", goFinal);
|
|
|
|
|
});
|
|
|
|
|
mousetrap.bind('g h', goHome)
|
|
|
|
|
mousetrap.bind('g t', goTask)
|
|
|
|
|
mousetrap.bind('g a', goWorksheet)
|
|
|
|
|
mousetrap.bind('g e', goFinal)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const showPopover = ref(false);
|
|
|
|
|
const popRef = ref(null);
|
|
|
|
|
const changeFlag = ref(false);
|
|
|
|
|
const showPopover = ref(false)
|
|
|
|
|
const popRef = ref(null)
|
|
|
|
|
const changeFlag = ref(false)
|
|
|
|
|
|
|
|
|
|
const iconName = computed(() => {
|
|
|
|
|
return showPopover.value ? "expand" : "collapse";
|
|
|
|
|
});
|
|
|
|
|
return showPopover.value ? 'expand' : 'collapse'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function handleUpdateShow(show: boolean) {
|
|
|
|
|
showPopover.value = show;
|
|
|
|
|
showPopover.value = show
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logOut() {
|
|
|
|
|
(popRef.value as any).setShow(false);
|
|
|
|
|
emit("logout");
|
|
|
|
|
(popRef.value as any).setShow(false)
|
|
|
|
|
emit('logout')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const currentCompanyName = computed(() => {
|
|
|
|
|
const tenantList = useInfo.tenantList;
|
|
|
|
|
const currentId = userStore.getTenantId;
|
|
|
|
|
const current = tenantList.find((item) => item.id === currentId);
|
|
|
|
|
return current.name || "name";
|
|
|
|
|
});
|
|
|
|
|
const deptlist = useInfo.deptlist
|
|
|
|
|
const currentId = userStore.getTenantId
|
|
|
|
|
const current = deptlist.find(item => item.id === currentId)
|
|
|
|
|
return current.name || 'name'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const options = computed(() => {
|
|
|
|
|
const tenantList = useInfo.tenantList;
|
|
|
|
|
return tenantList.map((item) => {
|
|
|
|
|
const deptlist = useInfo.deptlist
|
|
|
|
|
return deptlist.map((item) => {
|
|
|
|
|
return {
|
|
|
|
|
label: item.name,
|
|
|
|
|
key: item.id,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
label: item.departname,
|
|
|
|
|
key: item.deptno,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@ -101,7 +101,7 @@ const options = computed(() => {
|
|
|
|
|
>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<div class="setting">
|
|
|
|
|
<span style="color:#333333">{{ useInfo.username }}</span>
|
|
|
|
|
<span style="color: #333333">{{ useInfo.username }}</span>
|
|
|
|
|
<SvgIcon style="margin-left: 6px" :name="iconName" size="16" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
@ -119,24 +119,28 @@ const options = computed(() => {
|
|
|
|
|
</div>
|
|
|
|
|
<div class="trigger">
|
|
|
|
|
<span>{{ currentCompanyName }}</span>
|
|
|
|
|
<span @click="changeFlag = !changeFlag" style="cursor: pointer"><SvgIcon name="switchCompany" size="24" /></span>
|
|
|
|
|
<span style="cursor: pointer" @click="changeFlag = !changeFlag"><SvgIcon name="switchCompany" size="24" /></span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="item">
|
|
|
|
|
<span>AI设置开关</span>
|
|
|
|
|
<n-switch v-model:value="aiDisabled" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="trigger">联系我们</div>
|
|
|
|
|
<div class="trigger">
|
|
|
|
|
联系我们
|
|
|
|
|
</div>
|
|
|
|
|
<n-divider style="margin-top: 0px; margin-bottom: 10px; padding: 0 22px" />
|
|
|
|
|
<div class="trigger" @click="logOut">退出登录</div>
|
|
|
|
|
<div class="trigger" @click="logOut">
|
|
|
|
|
退出登录
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="container sub-container"
|
|
|
|
|
v-show="changeFlag"
|
|
|
|
|
class="container sub-container"
|
|
|
|
|
style="position: absolute; right: 17vw; width: 11.5vw; padding: 24px 0"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="trigger"
|
|
|
|
|
v-for="option in options"
|
|
|
|
|
:key="option.key"
|
|
|
|
|
class="trigger"
|
|
|
|
|
@click="handleSelect(option)"
|
|
|
|
|
>
|
|
|
|
|
{{ option.label }}
|
|
|
|
|