|
@@ -1,17 +1,18 @@
|
|
|
<template>
|
|
|
<div class="navbar">
|
|
|
- <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
|
|
+ <hamburger id="hamburger-container" :is-active="appStore.sidebar.opened" class="hamburger-container"
|
|
|
+ @toggleClick="toggleSideBar" />
|
|
|
<breadcrumb id="breadcrumb-container" class="breadcrumb-container" v-if="!settingsStore.topNav" />
|
|
|
<top-nav id="topmenu-container" class="topmenu-container" v-if="settingsStore.topNav" />
|
|
|
|
|
|
<div class="right-menu">
|
|
|
<div style="color: #fff; padding-right: 16px; font-size: 14px">
|
|
|
<span>当前厂别:</span>
|
|
|
- <template v-if="currentTenantName!='超级管理员'">
|
|
|
- <span style="cursor: pointer" @click="handleShowTenantDialog">{{ currentTenantName }}</span>
|
|
|
+ <template v-if="currentTenantName != '超级管理员'">
|
|
|
+ <span style="cursor: pointer" @click="handleShowTenantDialog">{{ currentTenantName }}</span>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <span style="cursor: pointer" >{{ currentTenantName }}</span>
|
|
|
+ <span style="cursor: pointer">{{ currentTenantName }}</span>
|
|
|
</template>
|
|
|
<!-- <span style="cursor: pointer" @click="handleShowTenantDialog">{{ currentTenantName }}</span> -->
|
|
|
</div>
|
|
@@ -44,6 +45,14 @@
|
|
|
<el-dropdown-item command="setLayout">
|
|
|
<span>布局设置</span>
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="message" v-if="settingsStore.showMessage">
|
|
|
+ <el-badge :value="messageCount" :max="99" class="item" :hidden="messageCount == 0">
|
|
|
+ <span>站内信</span>
|
|
|
+ </el-badge>
|
|
|
+ </el-dropdown-item>
|
|
|
+ <el-dropdown-item command="sendMessage" v-if="settingsStore.showMessage">
|
|
|
+ <span>发站内信</span>
|
|
|
+ </el-dropdown-item>
|
|
|
<el-dropdown-item divided command="logout">
|
|
|
<span>退出登录</span>
|
|
|
</el-dropdown-item>
|
|
@@ -58,11 +67,63 @@
|
|
|
<el-table-column label="厂别" prop="orgName" header-align="center" />
|
|
|
<el-table-column label="选择" prop="createTime" width="50" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button link type="success" icon="Check" size="small" @click="handleChangeTenant(scope.row)" >选择</el-button>
|
|
|
+ <el-button link type="success" icon="Check" size="small"
|
|
|
+ @click="handleChangeTenant(scope.row)">选择</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog title="站内信" v-model="showMessageDialog" width="450" center @close="showMessageDialog = false">
|
|
|
+ <div class="page-container column-container">
|
|
|
+ <el-table ref="dialogTable" :data="messageList" height="460px" row-key="id" align="center">
|
|
|
+ <el-table-column label="行号" type="index" width="50" align="center" />
|
|
|
+ <el-table-column label="消息来源" prop="fromNickName" align="center" />
|
|
|
+ <el-table-column label="消息内容" prop="message" align="center" show-overflow-tooltip />
|
|
|
+ <el-table-column label="查看" width="120" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button type="success" icon="view" circle @click="handleView(scope.row)" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize" @pagination="getMessages" size="small"
|
|
|
+ layout="total, prev, next, jumper" />
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog title="发消息" v-model="addMessageDialog" width="450" center @close="closeMessageFormDialog">
|
|
|
+ <el-form ref="addMessageFormRef" v-model="messageData" label-width="100">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="收件人">
|
|
|
+ <el-autocomplete :fetch-suggestions="querySearchAsync" :trigger-on-focus="true" style="width: 100%"
|
|
|
+ v-model="messageData.toNickName" placeholder="选择人员" popper-class="my-autocomplete"
|
|
|
+ @select="handleSelectEmployee">
|
|
|
+ <template #default="{ item }">
|
|
|
+ <div style="
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ justify-content: space-between;
|
|
|
+ ">
|
|
|
+ <div class="name" style="font-size: 12px">
|
|
|
+ {{ item.nickName }}
|
|
|
+ </div>
|
|
|
+ <span class="code" style="font-size: 10px; color: darkgrey">{{ item.userName }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-autocomplete>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="发送信息">
|
|
|
+ <el-input type="textarea" v-model="messageData.message"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="sendMessage">发送</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -72,6 +133,7 @@ import Breadcrumb from '@/components/Breadcrumb'
|
|
|
import TopNav from '@/components/TopNav'
|
|
|
import Hamburger from '@/components/Hamburger'
|
|
|
import Screenfull from '@/components/Screenfull'
|
|
|
+import { selectUserList, getInfo } from "@/api/business/noCurrentReject";
|
|
|
// import SizeSelect from '@/components/SizeSelect'
|
|
|
// import HeaderSearch from '@/components/HeaderSearch'
|
|
|
// import RuoYiGit from '@/components/RuoYi/Git'
|
|
@@ -81,17 +143,35 @@ import useUserStore from '@/store/modules/user'
|
|
|
import useSettingsStore from '@/store/modules/settings'
|
|
|
import { setTenant, getTenant } from '@/utils/auth'
|
|
|
import { listTenant } from '@/api/business/tenant.js'
|
|
|
+import { listMessage } from '@/api/business/message.js'
|
|
|
import router from '@/router'
|
|
|
+import useMessageStore from '@/store/modules/message'
|
|
|
+import { nextTick, onBeforeUnmount, onMounted } from 'vue'
|
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
const appStore = useAppStore()
|
|
|
const userStore = useUserStore()
|
|
|
const settingsStore = useSettingsStore()
|
|
|
-
|
|
|
+const messageCount = ref(0)
|
|
|
+const showMessageDialog = ref(false)
|
|
|
const tenantLoading = ref(false)
|
|
|
const showDialog = ref(false)
|
|
|
+const addMessageDialog = ref(false)
|
|
|
const tenantList = ref([])
|
|
|
+const messageList = ref([])
|
|
|
+const messageData = ref({
|
|
|
+ fromUserId: useUserStore().user.userId,
|
|
|
+ toUserId: null,
|
|
|
+ toUserName: null,
|
|
|
+ toNickName: null,
|
|
|
+ message: null
|
|
|
+})
|
|
|
const currentTenantName = ref(getTenant().tenantName)
|
|
|
+const total = ref(0)
|
|
|
+const queryParams = ref({
|
|
|
+ pageSize: 10,
|
|
|
+ pageNum: 1
|
|
|
+})
|
|
|
|
|
|
function toggleSideBar() {
|
|
|
appStore.toggleSideBar()
|
|
@@ -105,6 +185,13 @@ function handleCommand(command) {
|
|
|
case 'logout':
|
|
|
logout()
|
|
|
break
|
|
|
+ case 'message':
|
|
|
+ showMessageDialog.value = true
|
|
|
+ getMessages()
|
|
|
+ break
|
|
|
+ case 'sendMessage':
|
|
|
+ addMessageDialog.value = true
|
|
|
+ break
|
|
|
default:
|
|
|
break
|
|
|
}
|
|
@@ -122,7 +209,7 @@ function logout() {
|
|
|
location.href = '/index'
|
|
|
})
|
|
|
})
|
|
|
- .catch(() => {})
|
|
|
+ .catch(() => { })
|
|
|
}
|
|
|
|
|
|
const emits = defineEmits(['setLayout'])
|
|
@@ -154,7 +241,7 @@ const handleChangeTenant = (row) => {
|
|
|
})
|
|
|
location.reload()
|
|
|
})
|
|
|
- .catch(() => {})
|
|
|
+ .catch(() => { })
|
|
|
}
|
|
|
|
|
|
const loadTenant = () => {
|
|
@@ -166,6 +253,66 @@ const loadTenant = () => {
|
|
|
tenantLoading.value = false
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+const messageCountChanged = (count) => {
|
|
|
+
|
|
|
+}
|
|
|
+const getMessages = () => {
|
|
|
+ console.log(userStore)
|
|
|
+ queryParams.value.toUserId = useUserStore().user.userId
|
|
|
+ listMessage(queryParams.value).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ messageList.value = res.rows
|
|
|
+ total.value = res.total
|
|
|
+ } else {
|
|
|
+ messageList.value = []
|
|
|
+ total.value = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const closeMessageFormDialog = () => {
|
|
|
+ addMessageDialog.value = false
|
|
|
+ messageData.value = {
|
|
|
+ fromUserId: useUserStore().user.userId,
|
|
|
+ toUserId: null,
|
|
|
+ toUserName: null,
|
|
|
+ toNickName: null,
|
|
|
+ message: null
|
|
|
+ }
|
|
|
+}
|
|
|
+function querySearchAsync(queryString, cb) {
|
|
|
+ if (queryString) {
|
|
|
+ selectUserList(queryString).then((res) => {
|
|
|
+ cb(res.rows);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function handleSelectEmployee(item) {
|
|
|
+ messageData.value.toNickName = item.nickName;
|
|
|
+ messageData.value.toUserId = item.userId;
|
|
|
+ messageData.value.toUserName = item.userName;
|
|
|
+}
|
|
|
+
|
|
|
+function sendMessage() {
|
|
|
+ useMessageStore().sendMsg(messageData.value)
|
|
|
+ closeMessageFormDialog()
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ window.addEventListener('messageChange', (target) => {
|
|
|
+ const count = target.detail
|
|
|
+ if (count != messageCount.value) {
|
|
|
+ messageCount.value = count
|
|
|
+ }
|
|
|
+ // console.log(messageCount)
|
|
|
+ })
|
|
|
+})
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ window.removeEventListener('messageChange')
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|