fix:工单样式兼容移动端
This commit is contained in:
@@ -0,0 +1,360 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="选择路径权限"
|
||||
width="900px"
|
||||
append-to-body
|
||||
@close="handleClose"
|
||||
>
|
||||
<div class="permission-selector">
|
||||
<!-- 搜索筛选区域 -->
|
||||
<div class="filter-section">
|
||||
<el-form :inline="true" :model="searchParams" class="search-form">
|
||||
<el-form-item label="关键词">
|
||||
<el-input
|
||||
v-model="searchParams.key"
|
||||
placeholder="搜索路径或名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
style="width: 200px"
|
||||
>
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="请求方法">
|
||||
<el-select
|
||||
v-model="searchParams.method"
|
||||
placeholder="全部方法"
|
||||
clearable
|
||||
style="width: 120px"
|
||||
>
|
||||
<el-option label="GET" value="GET" />
|
||||
<el-option label="POST" value="POST" />
|
||||
<el-option label="PUT" value="PUT" />
|
||||
<el-option label="DELETE" value="DELETE" />
|
||||
<el-option label="PATCH" value="PATCH" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch" :icon="Search">
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button @click="handleReset" :icon="Refresh">
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<!-- 权限列表表格 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="filteredList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
style="width: 100%"
|
||||
:height="400"
|
||||
:row-class-name="tableRowClassName"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="id" label="ID" width="80" align="center" />
|
||||
<el-table-column prop="method" label="方法" width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.method" :type="getMethodTag(row.method)" size="small">
|
||||
{{ row.method }}
|
||||
</el-tag>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="path" label="路径" min-width="250" show-overflow-tooltip />
|
||||
<el-table-column prop="name" label="名称" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column prop="note" label="备注" min-width="150" show-overflow-tooltip />
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-container" v-if="total > 0">
|
||||
<el-pagination
|
||||
v-model:current-page="searchParams.page"
|
||||
v-model:page-size="searchParams.count"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 已选信息 -->
|
||||
<div class="selected-info" v-if="selectedPermission">
|
||||
<el-alert type="success" :closable="false">
|
||||
<template #title>
|
||||
<div class="selected-content">
|
||||
<span>已选择: </span>
|
||||
<el-tag v-if="selectedPermission.method" :type="getMethodTag(selectedPermission.method)" size="small" style="margin-right: 8px;">
|
||||
{{ selectedPermission.method }}
|
||||
</el-tag>
|
||||
<span class="selected-path">{{ selectedPermission.path }}</span>
|
||||
<span class="selected-name" v-if="selectedPermission.name"> - {{ selectedPermission.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleConfirm" :disabled="!selectedPermission">
|
||||
确认选择
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
import { getPermissionList } from '@/api/admin/Permission'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
currentPermissionId: {
|
||||
type: Number,
|
||||
default: null
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'confirm'])
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val) => emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
// 搜索参数
|
||||
const searchParams = reactive({
|
||||
key: '',
|
||||
method: '',
|
||||
page: 1,
|
||||
count: 20
|
||||
})
|
||||
|
||||
// 状态
|
||||
const loading = ref(false)
|
||||
const permissionList = ref([])
|
||||
const total = ref(0)
|
||||
const selectedPermission = ref(null)
|
||||
|
||||
// 过滤后的列表
|
||||
const filteredList = computed(() => {
|
||||
let list = permissionList.value
|
||||
|
||||
// 关键词过滤
|
||||
if (searchParams.key) {
|
||||
const keyword = searchParams.key.toLowerCase()
|
||||
list = list.filter(item =>
|
||||
(item.path && item.path.toLowerCase().includes(keyword)) ||
|
||||
(item.name && item.name.toLowerCase().includes(keyword)) ||
|
||||
(item.note && item.note.toLowerCase().includes(keyword))
|
||||
)
|
||||
}
|
||||
|
||||
// 方法过滤
|
||||
if (searchParams.method) {
|
||||
list = list.filter(item => item.method === searchParams.method)
|
||||
}
|
||||
|
||||
return list
|
||||
})
|
||||
|
||||
// 获取方法标签颜色
|
||||
const getMethodTag = (method) => {
|
||||
const tagMap = {
|
||||
'GET': 'success',
|
||||
'POST': 'primary',
|
||||
'PUT': 'warning',
|
||||
'DELETE': 'danger',
|
||||
'PATCH': 'info'
|
||||
}
|
||||
return tagMap[method?.toUpperCase()] || 'info'
|
||||
}
|
||||
|
||||
// 表格行样式
|
||||
const tableRowClassName = ({ row }) => {
|
||||
if (selectedPermission.value && row.id === selectedPermission.value.id) {
|
||||
return 'selected-row'
|
||||
}
|
||||
if (props.currentPermissionId && row.id === props.currentPermissionId) {
|
||||
return 'current-row'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// 获取权限列表
|
||||
const fetchPermissionList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getPermissionList({
|
||||
page: 1,
|
||||
count: 10
|
||||
})
|
||||
if (res.data.code === 200) {
|
||||
permissionList.value = res.data.data?.list || []
|
||||
total.value = permissionList.value.length
|
||||
} else {
|
||||
ElMessage.error(res.data.message || '获取权限列表失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取权限列表失败:', error)
|
||||
ElMessage.error('获取权限列表失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
searchParams.page = 1
|
||||
}
|
||||
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
searchParams.key = ''
|
||||
searchParams.method = ''
|
||||
searchParams.page = 1
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (size) => {
|
||||
searchParams.count = size
|
||||
searchParams.page = 1
|
||||
}
|
||||
|
||||
const handlePageChange = (page) => {
|
||||
searchParams.page = page
|
||||
}
|
||||
|
||||
// 选择行
|
||||
const handleCurrentChange = (row) => {
|
||||
selectedPermission.value = row
|
||||
}
|
||||
|
||||
// 确认选择
|
||||
const handleConfirm = () => {
|
||||
if (selectedPermission.value) {
|
||||
emit('confirm', selectedPermission.value)
|
||||
handleClose()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const handleClose = () => {
|
||||
visible.value = false
|
||||
selectedPermission.value = null
|
||||
handleReset()
|
||||
}
|
||||
|
||||
// 监听弹窗打开
|
||||
watch(() => props.modelValue, (val) => {
|
||||
if (val) {
|
||||
fetchPermissionList()
|
||||
// 如果有当前选中的ID,尝试预选
|
||||
if (props.currentPermissionId) {
|
||||
const found = permissionList.value.find(p => p.id === props.currentPermissionId)
|
||||
if (found) {
|
||||
selectedPermission.value = found
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.permission-selector {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
margin-bottom: 16px;
|
||||
padding: 16px;
|
||||
background: #fafbfc;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.selected-info {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.selected-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.selected-path {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.selected-name {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
:deep(.el-table .selected-row) {
|
||||
background-color: #ecf5ff !important;
|
||||
}
|
||||
|
||||
:deep(.el-table .current-row) {
|
||||
background-color: #f0f9eb !important;
|
||||
}
|
||||
|
||||
:deep(.el-table .selected-row td),
|
||||
:deep(.el-table .current-row td) {
|
||||
background-color: inherit !important;
|
||||
}
|
||||
|
||||
/* 移动端适配 */
|
||||
@media (max-width: 768px) {
|
||||
:deep(.el-dialog) {
|
||||
width: 95% !important;
|
||||
margin: 2vh auto !important;
|
||||
}
|
||||
|
||||
.filter-section {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.search-form .el-form-item {
|
||||
margin-right: 0;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-form .el-input,
|
||||
.search-form .el-select {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -24,9 +24,15 @@
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员组" v-if="queryParams.owner_type === 'group'">
|
||||
<el-select v-model="queryParams.admin_group_id" placeholder="请选择管理员组" clearable filterable style="width: 200px">
|
||||
<el-option v-for="item in adminGroupOptions" :key="item.id" :label="`${item.name} (ID: ${item.id})`" :value="item.id" />
|
||||
</el-select>
|
||||
<div class="selector-inline">
|
||||
<el-tag v-if="queryParams.admin_group_id" type="success" closable @close="clearQueryGroup" style="margin-right: 8px;">
|
||||
{{ getQueryGroupName() }}
|
||||
</el-tag>
|
||||
<el-button type="success" plain @click="openQueryGroupSelector" size="default">
|
||||
<el-icon><User /></el-icon>
|
||||
{{ queryParams.admin_group_id ? '重新选择' : '选择管理员组' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleQuery">
|
||||
@@ -115,14 +121,34 @@
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 用户选择弹窗 -->
|
||||
<el-dialog
|
||||
<!-- 用户选择弹窗 - 使用UserListSelector组件 -->
|
||||
<UserListSelector
|
||||
v-model="userSelectorVisible"
|
||||
:current-user-id="selectorType === 'query' ? queryParams.user_id : permissionForm.user_id"
|
||||
@confirm="handleUserSelectorConfirm"
|
||||
/>
|
||||
|
||||
<!-- 管理员组选择弹窗 - 使用UserGroupSelector组件 -->
|
||||
<UserGroupSelector
|
||||
v-model="groupSelectorVisible"
|
||||
:current-group-id="selectorType === 'query' ? queryParams.admin_group_id : permissionForm.admin_group_id"
|
||||
@confirm="handleGroupSelectorConfirm"
|
||||
/>
|
||||
|
||||
<!-- 路径权限选择弹窗 -->
|
||||
<PermissionPathSelector
|
||||
v-model="permissionSelectorVisible"
|
||||
:current-permission-id="permissionForm.permission_id"
|
||||
@confirm="handlePermissionSelectorConfirm"
|
||||
/>
|
||||
|
||||
<!-- 旧的用户选择弹窗 - 已废弃 -->
|
||||
<!-- <el-dialog
|
||||
v-model="userSelectorVisibleOld"
|
||||
title="选择用户"
|
||||
width="800px"
|
||||
class="user-selector-dialog"
|
||||
>
|
||||
<!-- 搜索栏 -->
|
||||
<div class="selector-search">
|
||||
<el-input
|
||||
v-model="userSearchParams.key"
|
||||
@@ -142,7 +168,6 @@
|
||||
<el-button @click="resetUserSearch">重置</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 用户表格 -->
|
||||
<el-table
|
||||
v-loading="userSelectorLoading"
|
||||
:data="userSelectorList"
|
||||
@@ -164,7 +189,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
|
||||
<el-pagination
|
||||
v-model:current-page="userSearchParams.page"
|
||||
v-model:page-size="userSearchParams.count"
|
||||
@@ -178,12 +203,12 @@
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="userSelectorVisible = false">取消</el-button>
|
||||
<el-button @click="userSelectorVisibleOld = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmUserSelection" :disabled="!selectedUserTemp">
|
||||
确定选择
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</el-dialog> -->
|
||||
<!-- 分配权限对话框 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
@@ -204,45 +229,80 @@
|
||||
<div class="form-tip">如果是 user 则填写 user_id,如果是 group 则填写 admin_group_id</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户" prop="user_id" v-if="permissionForm.owner_type === 'user'" >
|
||||
<div class="user_selector-inline">
|
||||
<el-tag v-if="permissionForm.user_id" type="primary" closable @close="clearFormUser" style="margin-right: 8px;">
|
||||
{{ getFormUserName() }}
|
||||
</el-tag>
|
||||
<el-button type="primary" plain @click="openFormUserSelector" size="default" :disabled="permissionForm.user_id">
|
||||
<el-icon><User /></el-icon>
|
||||
{{ permissionForm.user_id ? '重新选择' : '选择用户' }}
|
||||
<div class="recommend-user-selector">
|
||||
<el-input
|
||||
:model-value="getFormUserName()"
|
||||
placeholder="点击选择用户"
|
||||
readonly
|
||||
@click="openFormUserSelector"
|
||||
:disabled="!!permissionForm.id"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="openFormUserSelector" :disabled="!!permissionForm.id">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
v-if="permissionForm.user_id && !permissionForm.id"
|
||||
type="danger"
|
||||
link
|
||||
@click="clearFormUser"
|
||||
class="clear-btn"
|
||||
>
|
||||
清除
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员组" prop="admin_group_id" v-if="permissionForm.owner_type === 'group'">
|
||||
<el-select v-model="permissionForm.admin_group_id" placeholder="请选择管理员组" filterable style="width: 100%">
|
||||
<el-option v-for="item in adminGroupOptions" :key="item.id" :label="`${item.name} (ID: ${item.id})`" :value="item.id" />
|
||||
</el-select>
|
||||
<div class="recommend-user-selector">
|
||||
<el-input
|
||||
:model-value="getFormGroupName()"
|
||||
placeholder="点击选择管理员组"
|
||||
readonly
|
||||
@click="openFormGroupSelector"
|
||||
:disabled="!!permissionForm.id"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="openFormGroupSelector" :disabled="!!permissionForm.id">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
v-if="permissionForm.admin_group_id && !permissionForm.id"
|
||||
type="danger"
|
||||
link
|
||||
@click="clearFormGroup"
|
||||
class="clear-btn"
|
||||
>
|
||||
清除
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="路径权限" prop="permission_id">
|
||||
<div style="display: flex; gap: 8px;">
|
||||
<el-select
|
||||
v-model="permissionForm.permission_id"
|
||||
placeholder="请选择路径权限"
|
||||
filterable
|
||||
style="flex: 1"
|
||||
:loading="permissionLoading"
|
||||
<div class="recommend-user-selector">
|
||||
<el-input
|
||||
:model-value="getFormPermissionName()"
|
||||
placeholder="点击选择路径权限"
|
||||
readonly
|
||||
@click="openPermissionSelector"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in permissionOptions"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
<template #append>
|
||||
<el-button @click="openPermissionSelector">
|
||||
<el-icon><Search /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button
|
||||
v-if="permissionForm.permission_id"
|
||||
type="danger"
|
||||
link
|
||||
@click="clearFormPermission"
|
||||
class="clear-btn"
|
||||
>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<span>
|
||||
<el-tag v-if="item.method" :type="getMethodTag(item.method)" size="small" style="margin-right: 8px;">{{ item.method }}</el-tag>
|
||||
{{ item.path }}
|
||||
</span>
|
||||
<span style="color: #999; font-size: 12px; margin-left: 12px;">{{ item.note || item.name || `ID: ${item.id}` }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button @click="fetchPermissionList" :loading="permissionLoading" :icon="Refresh">刷新</el-button>
|
||||
清除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="form-tip">共 {{ permissionOptions.length }} 个路径权限可选</div>
|
||||
</el-form-item>
|
||||
@@ -283,6 +343,9 @@
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Plus, Search, Refresh, User } from '@element-plus/icons-vue'
|
||||
import UserListSelector from '@/components/admin/UserListSelector.vue'
|
||||
import UserGroupSelector from '@/components/admin/UserGroupSelector.vue'
|
||||
import PermissionPathSelector from '@/components/admin/PermissionPathSelector.vue'
|
||||
import {
|
||||
getPermissionListByAdmin,
|
||||
addPermissionAdmin,
|
||||
@@ -297,6 +360,8 @@ import { formatDate ,timeToTimestamp} from '@/utils/tool'
|
||||
|
||||
const selectorType = ref('query')
|
||||
const userSelectorVisible = ref(false)
|
||||
const groupSelectorVisible = ref(false)
|
||||
const permissionSelectorVisible = ref(false)
|
||||
const userSelectorList = ref([])
|
||||
const userSelectorTotal = ref(0)
|
||||
const userSearchParams = reactive({
|
||||
@@ -307,6 +372,8 @@ const userSearchParams = reactive({
|
||||
const selectedUserTemp = ref(null)
|
||||
const userSelectorLoading = ref(false)
|
||||
const UserOptions = ref([])
|
||||
const GroupOptions = ref([])
|
||||
const selectedPermission = ref(null)
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
owner_type: '',
|
||||
@@ -324,16 +391,122 @@ const getQueryUserName = () => {
|
||||
const user = UserOptions.value.find(u => u.UserId === queryParams.user_id)
|
||||
return user ? `${user.UserName} (ID: ${user.UserId})` : `用户ID: ${queryParams.user_id}`
|
||||
}
|
||||
// 清除查询管理员组
|
||||
const clearQueryGroup = () => {
|
||||
queryParams.admin_group_id = undefined
|
||||
}
|
||||
// 获取查询管理员组名称
|
||||
const getQueryGroupName = () => {
|
||||
const group = GroupOptions.value.find(g => g.id === queryParams.admin_group_id) ||
|
||||
adminGroupOptions.value.find(g => g.id === queryParams.admin_group_id)
|
||||
return group ? `${group.name} (ID: ${group.id})` : `管理员组ID: ${queryParams.admin_group_id}`
|
||||
}
|
||||
// 打开查询管理员组选择器
|
||||
const openQueryGroupSelector = () => {
|
||||
selectorType.value = 'query'
|
||||
groupSelectorVisible.value = true
|
||||
}
|
||||
// 表单:清除用户
|
||||
const clearFormUser = () => {
|
||||
permissionForm.user_id = undefined
|
||||
}
|
||||
// 表单:获取显示名称
|
||||
const getFormUserName = () => {
|
||||
if (!permissionForm.user_id) return ''
|
||||
const user = UserOptions.value.find(u => u.UserId === permissionForm.user_id)
|
||||
return user ? `${user.UserName} (ID: ${user.UserId})` : `用户ID: ${permissionForm.user_id}`
|
||||
}
|
||||
// 确认用户选择
|
||||
|
||||
// 表单:获取管理员组显示名称
|
||||
const getFormGroupName = () => {
|
||||
if (!permissionForm.admin_group_id) return ''
|
||||
const group = GroupOptions.value.find(g => g.id === permissionForm.admin_group_id)
|
||||
return group ? `${group.name} (ID: ${group.id})` : `管理员组ID: ${permissionForm.admin_group_id}`
|
||||
}
|
||||
|
||||
// 表单:获取路径权限显示名称
|
||||
const getFormPermissionName = () => {
|
||||
if (!permissionForm.permission_id) return ''
|
||||
if (selectedPermission.value && selectedPermission.value.id === permissionForm.permission_id) {
|
||||
const p = selectedPermission.value
|
||||
return `${p.method || ''} ${p.path}${p.name ? ' - ' + p.name : ''}`
|
||||
}
|
||||
const perm = permissionOptions.value.find(p => p.id === permissionForm.permission_id)
|
||||
return perm ? `${perm.method || ''} ${perm.path}${perm.name ? ' - ' + perm.name : ''}` : `权限ID: ${permissionForm.permission_id}`
|
||||
}
|
||||
|
||||
// 清除表单管理员组
|
||||
const clearFormGroup = () => {
|
||||
permissionForm.admin_group_id = undefined
|
||||
}
|
||||
|
||||
// 清除表单路径权限
|
||||
const clearFormPermission = () => {
|
||||
permissionForm.permission_id = undefined
|
||||
selectedPermission.value = null
|
||||
}
|
||||
|
||||
// 打开管理员组选择器
|
||||
const openFormGroupSelector = () => {
|
||||
selectorType.value = 'form'
|
||||
groupSelectorVisible.value = true
|
||||
}
|
||||
|
||||
// 打开路径权限选择器
|
||||
const openPermissionSelector = () => {
|
||||
permissionSelectorVisible.value = true
|
||||
}
|
||||
|
||||
// 管理员组选择确认
|
||||
const handleGroupSelectorConfirm = (group) => {
|
||||
if (group) {
|
||||
const groupId = group.id || group.Id
|
||||
const groupName = group.name || group.Name
|
||||
|
||||
if (selectorType.value === 'query') {
|
||||
queryParams.admin_group_id = groupId
|
||||
} else {
|
||||
permissionForm.admin_group_id = groupId
|
||||
}
|
||||
|
||||
if (!GroupOptions.value.find(g => g.id === groupId)) {
|
||||
GroupOptions.value.push({ id: groupId, name: groupName })
|
||||
}
|
||||
}
|
||||
groupSelectorVisible.value = false
|
||||
}
|
||||
|
||||
// 路径权限选择确认
|
||||
const handlePermissionSelectorConfirm = (permission) => {
|
||||
if (permission) {
|
||||
permissionForm.permission_id = permission.id
|
||||
selectedPermission.value = permission
|
||||
}
|
||||
permissionSelectorVisible.value = false
|
||||
}
|
||||
// UserListSelector 组件确认回调
|
||||
const handleUserSelectorConfirm = (user) => {
|
||||
if (user) {
|
||||
const userId = user.user_id || user.UserId
|
||||
const userName = user.user_name || user.UserName
|
||||
|
||||
if (selectorType.value === 'query') {
|
||||
queryParams.user_id = userId
|
||||
// 添加到 UserOptions 用于显示名称
|
||||
if (!UserOptions.value.find(u => u.UserId === userId)) {
|
||||
UserOptions.value.push({ UserId: userId, UserName: userName })
|
||||
}
|
||||
} else if (selectorType.value === 'form') {
|
||||
permissionForm.user_id = userId
|
||||
if (!UserOptions.value.find(u => u.UserId === userId)) {
|
||||
UserOptions.value.push({ UserId: userId, UserName: userName })
|
||||
}
|
||||
}
|
||||
}
|
||||
userSelectorVisible.value = false
|
||||
}
|
||||
|
||||
// 确认用户选择(旧方法,保留兼容)
|
||||
const confirmUserSelection = () => {
|
||||
if (!selectedUserTemp.value) {
|
||||
ElMessage.warning('请选择一个用户')
|
||||
@@ -684,7 +857,7 @@ const fetchUserList = async () => {
|
||||
try {
|
||||
const res = await getUserList({
|
||||
page: 1,
|
||||
count: 10000,
|
||||
count: 10,
|
||||
key: ''
|
||||
})
|
||||
if (res.data.code === 200) {
|
||||
@@ -700,7 +873,7 @@ const fetchAdminGroupList = async () => {
|
||||
try {
|
||||
const res = await getAdminGroupList({
|
||||
page: 1,
|
||||
count: 1000
|
||||
count: 10
|
||||
})
|
||||
if (res.data.code === 200) {
|
||||
adminGroupOptions.value = res.data.data?.data || []
|
||||
@@ -716,7 +889,7 @@ const fetchPermissionList = async () => {
|
||||
try {
|
||||
const res = await getPermissionList({
|
||||
page: 1,
|
||||
count: 10000
|
||||
count: 10
|
||||
})
|
||||
if (res.data.code === 200) {
|
||||
permissionOptions.value = res.data.data?.list || []
|
||||
@@ -837,4 +1010,34 @@ onMounted(() => {
|
||||
:deep(.el-card__body) {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 推介人选择器样式 - 与UserList.vue保持一致 */
|
||||
.recommend-user-selector {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.recommend-user-selector .el-input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.recommend-user-selector .clear-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.selector-inline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.user_selector-inline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -437,7 +437,7 @@ const fetchGroupList = async () => {
|
||||
|
||||
const fetchAllGroupList = async () => {
|
||||
try {
|
||||
const res = await getSettingGroupList({ page: 1, count: 1000 })
|
||||
const res = await getSettingGroupList({ page: 1, count: 10 })
|
||||
if (res.data.code === 200) {
|
||||
allGroupList.value = res.data.data.data || []
|
||||
}
|
||||
@@ -635,8 +635,10 @@ const handleTypeChange = (type) => {
|
||||
}
|
||||
}
|
||||
|
||||
const handleAddSetting = () => {
|
||||
const handleAddSetting = async () => {
|
||||
settingDialogTitle.value = '新增配置'
|
||||
// 刷新配置组列表以确保数据最新
|
||||
await fetchAllGroupList()
|
||||
Object.assign(settingForm, {
|
||||
id: undefined,
|
||||
name: '',
|
||||
@@ -780,6 +782,7 @@ watch(activeTab, (newVal) => {
|
||||
if (newVal === 'group') {
|
||||
fetchGroupList()
|
||||
} else if (newVal === 'setting') {
|
||||
fetchAllGroupList() // 切换到配置管理时刷新配置组列表用于下拉筛选
|
||||
fetchSettingList()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1322,4 +1322,202 @@ onBeforeUnmount(() => {
|
||||
font-size: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* 平板尺寸响应式样式 */
|
||||
@media (max-width: 1024px) and (min-width: 769px) {
|
||||
.page-header {
|
||||
padding: 12px 16px;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.ticket-title {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.message-content {
|
||||
max-width: 70%;
|
||||
}
|
||||
|
||||
.quick-replies {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.input-area {
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 移动端响应式样式 */
|
||||
@media (max-width: 768px) {
|
||||
.ticket-detail-page {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.header-left .el-button {
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
order: 3;
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.ticket-title {
|
||||
order: 4;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
margin-top: 8px;
|
||||
white-space: normal;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.header-right .ticket-id {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.header-right .el-select {
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.header-right .el-button {
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.chat-container {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.chat-messages {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.message-content {
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
.message-text {
|
||||
padding: 10px 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.message-image {
|
||||
max-width: 150px;
|
||||
max-height: 150px;
|
||||
}
|
||||
|
||||
.reply-container {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.quick-replies {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quick-replies .el-button {
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.input-actions {
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.left-actions {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.input-actions .el-button--primary {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.hint-text {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 用户信息弹窗 */
|
||||
.user-popover {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.popover-header {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popover-info {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* 编辑消息弹窗 */
|
||||
:deep(.el-dialog) {
|
||||
width: 90% !important;
|
||||
margin: 5vh auto !important;
|
||||
}
|
||||
|
||||
.edit-images-container {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.edit-preview-item,
|
||||
.add-image-btn {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.header-left .el-button span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.header-left .el-button .el-icon {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.message-content {
|
||||
max-width: 85%;
|
||||
}
|
||||
|
||||
.preview-item {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -63,13 +63,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 工单表格 -->
|
||||
<!-- 工单表格(PC端) -->
|
||||
<el-table
|
||||
v-loading="isLoading"
|
||||
:data="filteredTickets"
|
||||
stripe
|
||||
style="width: 100%"
|
||||
@row-click="handleRowClick"
|
||||
class="desktop-table"
|
||||
>
|
||||
<el-table-column prop="id" label="工单号" width="100" />
|
||||
<el-table-column label="用户" width="180">
|
||||
@@ -107,6 +108,41 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 移动端卡片列表 -->
|
||||
<div class="mobile-ticket-list" v-loading="isLoading">
|
||||
<div
|
||||
v-for="ticket in filteredTickets"
|
||||
:key="ticket.id"
|
||||
class="ticket-card"
|
||||
@click="goToDetail(ticket)"
|
||||
>
|
||||
<div class="ticket-card-header">
|
||||
<span class="ticket-card-id">#{{ ticket.id }}</span>
|
||||
<el-tag :type="getStatusType(ticket.status)" size="small">
|
||||
{{ getStatusText(ticket.status) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="ticket-card-user">
|
||||
<el-avatar :size="28" :src="ticket.avatar">{{ ticket.username?.charAt(0) }}</el-avatar>
|
||||
<span class="ticket-card-username">{{ ticket.username }}</span>
|
||||
</div>
|
||||
<div class="ticket-card-title">{{ ticket.title }}</div>
|
||||
<div class="ticket-card-footer">
|
||||
<span class="ticket-card-time">{{ ticket.createTime }}</span>
|
||||
<div class="ticket-card-actions">
|
||||
<el-button type="primary" size="small" @click.stop="goToDetail(ticket)">回复</el-button>
|
||||
<el-button
|
||||
v-if="ticket.status !== 'completed'"
|
||||
type="success"
|
||||
size="small"
|
||||
@click.stop="handleComplete(ticket)"
|
||||
>结束</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-if="filteredTickets.length === 0 && !isLoading" description="暂无工单数据" />
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-wrapper">
|
||||
<el-pagination
|
||||
@@ -659,4 +695,248 @@ onBeforeUnmount(() => {
|
||||
:deep(.el-table tr) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* 移动端卡片列表 */
|
||||
.mobile-ticket-list {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.ticket-card {
|
||||
background: #fff;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.ticket-card:active {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.ticket-card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.ticket-card-id {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.ticket-card-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.ticket-card-username {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.ticket-card-title {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
margin-bottom: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ticket-card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ticket-card-time {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.ticket-card-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 大屏平板尺寸响应式样式 (1020px - 1280px) */
|
||||
@media (max-width: 1280px) and (min-width: 1021px) {
|
||||
.toolbar {
|
||||
padding: 12px 16px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.toolbar-right .el-select {
|
||||
width: 120px !important;
|
||||
}
|
||||
|
||||
.toolbar-right .el-input {
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
/* 表格列宽调整 */
|
||||
:deep(.el-table) {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
:deep(.el-table .el-table__cell) {
|
||||
padding: 10px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 平板尺寸响应式样式 (769px - 1020px) */
|
||||
@media (max-width: 1020px) and (min-width: 769px) {
|
||||
.toolbar {
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
padding: 12px 16px;
|
||||
gap: 12px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
width: 100%;
|
||||
justify-content: flex-start;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.status-tabs::-webkit-scrollbar {
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
.status-tabs::-webkit-scrollbar-thumb {
|
||||
background: #dcdfe6;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
width: 100%;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.toolbar-right .el-select {
|
||||
width: 120px !important;
|
||||
}
|
||||
|
||||
.toolbar-right .el-input {
|
||||
flex: 1;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
/* 表格列宽调整 */
|
||||
:deep(.el-table) {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
:deep(.el-table .el-table__cell) {
|
||||
padding: 8px 6px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 移动端响应式样式 */
|
||||
@media (max-width: 768px) {
|
||||
.ticket-list-page {
|
||||
height: auto;
|
||||
min-height: calc(100vh - 60px);
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
flex-direction: column;
|
||||
height: auto;
|
||||
padding: 12px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 4px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.status-tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex-shrink: 0;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.toolbar-right {
|
||||
width: 100%;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.toolbar-right .el-select,
|
||||
.toolbar-right .el-input {
|
||||
flex: 1;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.toolbar-right .el-button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* 隐藏PC端表格,显示移动端卡片 */
|
||||
:deep(.el-table) {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.mobile-ticket-list {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
padding: 12px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pagination-wrapper :deep(.el-pagination) {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pagination-wrapper :deep(.el-pagination__sizes),
|
||||
.pagination-wrapper :deep(.el-pagination__jump) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 用户选择弹窗移动端适配 */
|
||||
:deep(.el-dialog) {
|
||||
width: 90% !important;
|
||||
margin: 5vh auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.tab-item {
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tab-item .count {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
✅已完成、⚠️部分完成、❌未完成这样显示
|
||||
-----------------------------------------------------------------------------------------------需要解决
|
||||
|
||||
1.点击仪表盘的最近工单中的其中一项跳转到工单详情需要请求对应接口数据进行赋值/api/v1/admin/work_order/detail这个接口,传递work_id参数,在src/api/ticket.js文件下的getTicketDetail函数
|
||||
|
||||
### TODO List
|
||||
- [x] ✅ TicketDetail.vue兼容work_id参数(原来只支持id参数)
|
||||
- [x] ✅ fetchTicketDetail函数使用 route.query.id || route.query.work_id
|
||||
- [x] ✅ sendMessage函数使用 route.query.id || route.query.work_id
|
||||
- [x] ✅ handleStatusChange函数使用 route.query.id || route.query.work_id
|
||||
- [x] ✅ handleComplete函数使用 route.query.id || route.query.work_id
|
||||
- [x] ✅ 定时刷新和watch监听兼容work_id参数
|
||||
|
||||
-----------------------------------------------------------------------------------------------需要解决
|
||||
|
||||
规则限制:
|
||||
@@ -23,6 +13,7 @@
|
||||
- 提交时转换为秒级时间戳
|
||||
4.后续每次写的页面,组件都需要兼容移动端
|
||||
5.只要是关于选择用户,文件,优惠卷,代金卷的都使用组件
|
||||
6.只要是弹窗需要使用选择组件的都参照用户列表的编辑用户的推介人的选择样式在弹窗中
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user