This commit is contained in:
zlwu committed 2026-06-30 23:44:22 +08:00
1 parent d84f4b944c
commit 7c838cfb2d
249 files changed
+50600 -18556

No files matched your search

+85 -53
View File
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>组织管理</h2>
<h2 class="title-bar-heading">组织管理</h2>
</div>
<div class="filter-block">
@@ -17,10 +17,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按组织名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -37,9 +37,37 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarAddChild"
>
<el-icon><Plus /></el-icon>
新增子组织
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button class="btn-ghost" @click="toggleExpand">
{{ isExpandAll ? '全部折叠' : '全部展开' }}
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -63,7 +91,11 @@
min-width="140"
align="left"
header-align="left"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.deptName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="deptCategoryCode"
label="组织类别"
@@ -102,39 +134,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="160"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handleAddChild(row)">
新增子组织
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
</div>
@@ -249,12 +248,34 @@
:icon="OfficeBuilding"
:meta="`${viewRow?.leader ? '负责人:' + viewRow.leader : ''}${viewRow?.leader && viewRow?.createTime ? ' · ' : ''}${viewRow?.createTime || ''}`"
:sections="viewSections"
/>
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button class="btn-ghost" @click="handleAddChild(viewRow)">
<el-icon><Plus /></el-icon>
新增子组织
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</section>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -262,10 +283,8 @@
Plus,
Close,
Check,
View,
Edit,
Delete,
More,
OfficeBuilding,
RefreshLeft,
Search
@@ -689,26 +708,35 @@ const dictStore = useDictStore()
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'view':
handleView(row)
break
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条组织')
return
}
handleEdit(selectedRows.value[0])
}
async function handleDelete(row: Api.Dept.DeptItem)
function handleToolbarAddChild() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条组织')
return
}
handleAddChild(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条组织')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Dept.DeptItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
try {
const childCount = row.children?.length || 0
const confirmText = childCount
@@ -718,6 +746,10 @@ const dictStore = useDictStore()
await ElMessageBox.confirm(confirmText, '提示', { type: 'warning' })
await fetchDeleteDept(row.id)
ElMessage.success('删除成功')
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await Promise.all([loadData(), loadDeptTreeForSelect()])
} catch (error: any) {
if (error !== 'cancel') console.error('删除失败:', error)
+138 -75
View File
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>字典类型</h2>
<h2 class="title-bar-heading">字典类型</h2>
</div>
<div class="filter-block">
@@ -16,10 +16,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按字典名称、类型编码模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -36,6 +36,32 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarDictData"
>
<el-icon><Setting /></el-icon>
字典数据配置
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button
class="btn-ghost"
type="danger"
@@ -43,8 +69,11 @@
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -73,7 +102,11 @@
min-width="150"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.dictName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="dictType"
label="字典类型编码"
@@ -95,39 +128,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="130"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handleDictData(row)">
字典数据配置
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -192,6 +192,26 @@
:meta="`字典类型编码:${viewRow?.dictType || ''}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleDictData(viewRow)">
<el-icon><Setting /></el-icon>
字典数据配置
</el-button>
<el-button class="btn-ghost" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
<template #append>
<div class="view-section dict-view-data-section">
<h3>字典数据</h3>
@@ -272,10 +292,37 @@
</div>
<div class="list-toolbar dict-data-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ dictDataSelectedRows.length }}</span> 项
</div>
<el-button class="btn-main" type="primary" @click="handleAddDictData">
<el-icon><Plus /></el-icon>
新增数据
</el-button>
<el-button
class="btn-ghost"
:disabled="dictDataSelectedRows.length !== 1"
@click="handleToolbarEditDictData"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="
dictDataSelectedRows.length !== 1 || !canDeleteByCreator(dictDataSelectedRows[0])
"
:title="
dictDataSelectedRows.length === 1 && !canDeleteByCreator(dictDataSelectedRows[0])
? CREATOR_DELETE_TIP
: ''
"
@click="handleToolbarDeleteDictData"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</div>
</div>
<div class="list-body list-wrap dict-data-table-wrap">
@@ -285,7 +332,9 @@
v-loading="dictDataLoading"
stripe
row-key="id"
@selection-change="handleDictDataSelectionChange"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
@@ -336,27 +385,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleEditDictData(row)">
编辑
</el-button>
<el-button
class="btn-op-item"
:disabled="!canDeleteByCreator(row)"
:title="canDeleteByCreator(row) ? '' : CREATOR_DELETE_TIP"
@click="handleDeleteDictData(row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -456,6 +484,7 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, onMounted, computed } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -463,10 +492,9 @@
Plus,
Close,
Check,
View,
Edit,
Delete,
More,
Setting,
Collection,
RefreshLeft,
Search
@@ -490,7 +518,7 @@
const tableData = ref<Api.Dict.DictTypeItem[]>([])
const selectedRows = ref<Api.Dict.DictTypeItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增字典类型')
const isEdit = ref(false)
@@ -630,30 +658,63 @@
}
}
function handleDropdownCommand(command: string, row: Api.Dict.DictTypeItem) {
switch (command) {
case 'view':
handleView(row)
break
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarDictData() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条字典类型')
return
}
handleDictData(selectedRows.value[0])
}
async function handleDelete(row: Api.Dict.DictTypeItem)
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条字典类型')
return
}
handleEdit(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条字典类型')
return
}
handleDelete(selectedRows.value[0])
}
function handleDictDataSelectionChange(rows: Api.Dict.DictDataItem[]) {
dictDataSelectedRows.value = rows
}
function handleToolbarEditDictData() {
if (dictDataSelectedRows.value.length !== 1) {
ElMessage.warning('请选择一条字典数据')
return
}
handleEditDictData(dictDataSelectedRows.value[0])
}
function handleToolbarDeleteDictData() {
if (dictDataSelectedRows.value.length !== 1) {
ElMessage.warning('请选择一条字典数据')
return
}
handleDeleteDictData(dictDataSelectedRows.value[0])
}
async function handleDelete(row: Api.Dict.DictTypeItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
await ElMessageBox.confirm(`确定删除字典类型「${row.dictName}」吗?`, '提示', {
type: 'warning'
})
await fetchDeleteDictType(row.id)
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await loadData()
}
@@ -687,8 +748,9 @@
const dictDataDialogVisible = ref(false)
const dictDataTableData = ref<Api.Dict.DictDataItem[]>([])
const dictDataSelectedRows = ref<Api.Dict.DictDataItem[]>([])
const dictDataLoading = ref(false)
const dictDataPagination = reactive({ page: 1, pageSize: 10, total: 0 })
const dictDataPagination = reactive({ page: 1, pageSize: 20, total: 0 })
const currentDictType = reactive({ dictName: '', dictType: '' })
const dictDataFormVisible = ref(false)
const dictDataFormTitle = ref('新增字典数据')
@@ -729,6 +791,7 @@
currentDictType.dictName = row.dictName
currentDictType.dictType = row.dictType
dictDataPagination.page = 1
dictDataSelectedRows.value = []
dictDataDialogVisible.value = true
loadDictData()
}
+161 -40
View File
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>请假列表</h2>
<h2 class="title-bar-heading">请假列表</h2>
</div>
<div class="filter-block">
@@ -29,10 +29,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按原因、类型模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -45,7 +45,38 @@
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button class="btn-main" type="primary" @click="handleAdd">新增请假</el-button>
<el-button class="btn-main" type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增请假
</el-button>
<el-button
class="btn-ghost"
:disabled="!toolbarCanEdit"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
:disabled="!toolbarCanSubmit"
@click="handleToolbarSubmit"
>
<el-icon><Promotion /></el-icon>
提交审批
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!toolbarCanDelete"
:title="toolbarDeleteTitle"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -57,6 +88,7 @@
row-key="id"
v-loading="loading"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
@@ -65,7 +97,11 @@
min-width="100"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.leaveTypeLabel || '--' }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="startDate"
label="开始日期"
@@ -108,38 +144,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
fixed="right"
min-width="260"
align="center"
header-align="center"
>
<template #default="{ row }">
<template v-if="row.status === 'draft' || row.status === 'rejected'">
<el-button type="primary" link size="small" @click="handleEdit(row)"
>编辑</el-button
>
<el-button type="success" link size="small" @click="handleSubmit(row.id)"
>提交审批</el-button
>
<el-button
v-if="canDeleteByCreator(row)"
type="danger"
link
size="small"
@click="handleDelete(row)"
>删除</el-button
>
</template>
<template v-else-if="row.status === 'pending'">
<el-tag type="warning" size="small">审批中</el-tag>
</template>
<template v-else>
<span style="color: #1e293b; font-size: 12px">已结束</span>
</template>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
@@ -236,13 +240,45 @@
</el-button>
</template>
</el-dialog>
<SystemViewDialog
v-model:visible="viewVisible"
:title="viewingRecord?.leaveTypeLabel || '请假详情'"
:icon="Document"
:sections="leaveViewSections"
>
<template v-if="viewingRecord && canEditLeave(viewingRecord)" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewingRecord)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button class="btn-ghost" @click="handleSubmit(viewingRecord.id)">
<el-icon><Promotion /></el-icon>
提交审批
</el-button>
<el-button
v-if="canDeleteByCreator(viewingRecord)"
class="btn-ghost"
type="danger"
@click="handleDelete(viewingRecord)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</div>
</template>
<script setup lang="ts">
import { Close, Check, RefreshLeft, Search } from '@element-plus/icons-vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { Close, Check, RefreshLeft, Search, Plus, Edit, Delete, Promotion, Document } from '@element-plus/icons-vue'
import { useDictStore } from '@/store/modules/dict'
import { canDeleteByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
import {
fetchLeaveList,
fetchCreateLeave,
@@ -258,7 +294,7 @@
const loading = ref(false)
const tableData = ref<Api.Leave.LeaveItem[]>([])
const selectedRows = ref<Api.Leave.LeaveItem[]>([])
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const filterForm = reactive({ keyword: '', status: '' })
@@ -267,6 +303,54 @@
const editingId = ref('')
const submitting = ref(false)
const viewVisible = ref(false)
const viewingRecord = ref<Api.Leave.LeaveItem | null>(null)
const leaveViewSections = computed<ViewSection[]>(() => {
const row = viewingRecord.value
if (!row) return []
const fields: ViewField[] = [
{ label: '请假类型', value: row.leaveTypeLabel || '--' },
{ label: '状态', value: dictStore.getLabel('leave_status', row.status), tagType: dictStore.getTagType('leave_status', row.status) },
{ label: '开始日期', value: row.startDate || '--' },
{ label: '结束日期', value: row.endDate || '--' },
{ label: '天数', value: row.days != null ? String(row.days) : '--' },
{ label: '创建时间', value: row.createTime || '--' },
{ label: '请假原因', value: row.reason || '--', colSpan: 2 },
{ label: '备注', value: row.remark || '--', colSpan: 2 }
]
return [{ title: '基本信息', fields }]
})
const toolbarSelectedRow = computed(() =>
selectedRows.value.length === 1 ? selectedRows.value[0] : null
)
const toolbarCanEdit = computed(
() => !!toolbarSelectedRow.value && canEditLeave(toolbarSelectedRow.value)
)
const toolbarCanSubmit = computed(
() => !!toolbarSelectedRow.value && canEditLeave(toolbarSelectedRow.value)
)
const toolbarCanDelete = computed(() => {
const row = toolbarSelectedRow.value
return !!row && canEditLeave(row) && canDeleteByCreator(row)
})
const toolbarDeleteTitle = computed(() => {
const row = toolbarSelectedRow.value
if (!row) return ''
if (!canEditLeave(row)) return '仅草稿或已驳回状态可删除'
if (!canDeleteByCreator(row)) return CREATOR_DELETE_TIP
return ''
})
function canEditLeave(row: Api.Leave.LeaveItem) {
return row.status === 'draft' || row.status === 'rejected'
}
const formData = reactive({
leaveType: 'personal',
startDate: '',
@@ -326,6 +410,35 @@
dialogVisible.value = true
}
function handleView(row: Api.Leave.LeaveItem) {
viewingRecord.value = row
viewVisible.value = true
}
function handleToolbarEdit() {
if (!toolbarSelectedRow.value) {
ElMessage.warning('请选择一条请假记录')
return
}
handleEdit(toolbarSelectedRow.value)
}
function handleToolbarSubmit() {
if (!toolbarSelectedRow.value) {
ElMessage.warning('请选择一条请假记录')
return
}
handleSubmit(toolbarSelectedRow.value.id)
}
function handleToolbarDelete() {
if (!toolbarSelectedRow.value) {
ElMessage.warning('请选择一条请假记录')
return
}
handleDelete(toolbarSelectedRow.value)
}
function handleEdit(row: Api.Leave.LeaveItem) {
isEdit.value = true
editingId.value = row.id
@@ -365,13 +478,17 @@
type: 'warning'
})
await fetchSubmitLeave(id)
if (viewingRecord.value?.id === id) {
viewVisible.value = false
viewingRecord.value = null
}
loadData()
} catch {
// cancelled or error
}
}
async function handleDelete(row: { id: string }) {
async function handleDelete(row: Api.Leave.LeaveItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
@@ -379,6 +496,10 @@
try {
await ElMessageBox.confirm('确定删除此请假申请?', '提示', { type: 'warning' })
await fetchDeleteLeave(row.id)
if (viewingRecord.value?.id === row.id) {
viewVisible.value = false
viewingRecord.value = null
}
loadData()
} catch {
// cancelled or error
+85 -53
View File
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>菜单列表</h2>
<h2 class="title-bar-heading">菜单列表</h2>
</div>
<div class="filter-block">
@@ -16,10 +16,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按菜单名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -36,9 +36,37 @@
<el-icon><Plus /></el-icon>
新增
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarAddChild"
>
<el-icon><Plus /></el-icon>
新增子菜单
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button class="btn-ghost" @click="toggleExpand">
{{ isExpandAll ? '全部折叠' : '全部展开' }}
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -64,7 +92,11 @@
header-align="left"
class-name="col-menu-name"
label-class-name="col-menu-name"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.menuName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="menuType"
label="类型"
@@ -137,39 +169,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
min-width="160"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handleAddChild(row)">
新增子菜单
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
</div>
@@ -260,12 +259,34 @@
:icon="MenuIcon"
:meta="`类型:${dictStore.getLabel('menu_type', viewRow?.menuType || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
/>
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button class="btn-ghost" @click="handleAddChild(viewRow)">
<el-icon><Plus /></el-icon>
新增子菜单
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</section>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -273,10 +294,8 @@
Plus,
Close,
Check,
View,
Edit,
Delete,
More,
Menu as MenuIcon,
RefreshLeft,
Search
@@ -523,26 +542,35 @@
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'view':
handleView(row)
break
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条菜单')
return
}
handleEdit(selectedRows.value[0])
}
async function handleDelete(row: Api.Menu.MenuItem)
function handleToolbarAddChild() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条菜单')
return
}
handleAddChild(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条菜单')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Menu.MenuItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
try {
const childCount = row.children?.length || 0
const confirmText = childCount
@@ -552,6 +580,10 @@
await ElMessageBox.confirm(confirmText, '提示', { type: 'warning' })
await fetchDeleteMenu(row.id)
ElMessage.success('删除成功')
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await loadData()
} catch (error: any) {
if (error !== 'cancel') console.error('删除失败:', error)
+102 -16
View File
@@ -46,8 +46,36 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button
class="btn-main"
type="primary"
:disabled="selectedRows.length !== 1"
@click="handleToolbarView"
>
<el-icon><View /></el-icon>
查看详情
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="handleSearch" />
</div>
</div>
<div class="list-body list-wrap">
<el-table class="list-table" :data="tableData" stripe v-loading="loading" row-key="id">
<el-table
class="list-table"
:data="tableData"
stripe
v-loading="loading"
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="openDetail"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
@@ -69,7 +97,11 @@
label="操作摘要"
min-width="180"
show-overflow-tooltip
/>
>
<template #default="{ row }">
<el-link type="primary" @click="openDetail(row)">{{ row.operSummary || '—' }}</el-link>
</template>
</el-table-column>
<el-table-column prop="operName" label="操作人员" min-width="120" align="center" />
<el-table-column prop="operTime" label="操作时间" min-width="170" align="center" />
<el-table-column label="状态" min-width="90" align="center" header-align="center">
@@ -80,19 +112,6 @@
</template>
</el-table-column>
<el-table-column prop="costTime" label="耗时(ms)" min-width="100" align="center" />
<el-table-column
label="操作"
fixed="right"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button type="primary" link size="small" @click="openDetail(row)">
<el-icon><View /></el-icon>详情
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
@@ -118,6 +137,24 @@
:close-on-click-modal="false"
>
<div v-if="detailRow" class="operlog-detail-body">
<div class="operlog-view-hero">
<div class="operlog-view-hero-main">
<h2>{{ detailRow.title || '操作日志详情' }}</h2>
<div class="operlog-view-hero-tags">
<el-tag :type="getOperLogBusinessTypeTagType(detailRow.businessType)" size="small">
{{ getOperLogBusinessTypeLabel(detailRow.businessType) }}
</el-tag>
<el-tag :type="detailRow.status === 0 ? 'success' : 'danger'" size="small">
{{ detailRow.status === 0 ? '成功' : '失败' }}
</el-tag>
</div>
<p class="operlog-view-hero-meta">
操作人员:{{ detailRow.operName || '—' }}
<span class="dot">·</span>
{{ detailRow.operTime || '—' }}
</p>
</div>
</div>
<div class="detail-kv-grid">
<div class="detail-kv-item"><span class="label">操作模块</span><span>{{ detailRow.title }}</span></div>
<div class="detail-kv-item">
@@ -156,6 +193,7 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { Close, RefreshLeft, Search, View } from '@element-plus/icons-vue'
import { list as listOperLog, detail as getOperLogDetail } from '@/api/monitor/operlog'
import type { OperLogVO, OperLogQuery } from '@/api/monitor/operlog/types'
@@ -167,7 +205,8 @@ import {
const loading = ref(false)
const tableData = ref<OperLogVO[]>([])
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const selectedRows = ref<OperLogVO[]>([])
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const searchForm = reactive({
title: '',
businessType: undefined as number | undefined,
@@ -178,6 +217,18 @@ const searchForm = reactive({
const detailVisible = ref(false)
const detailRow = ref<OperLogVO | null>(null)
function handleSelectionChange(rows: OperLogVO[]) {
selectedRows.value = rows
}
function handleToolbarView() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条操作日志')
return
}
openDetail(selectedRows.value[0])
}
function buildQuery(): OperLogQuery {
return {
pageNum: pagination.page,
@@ -234,6 +285,41 @@ onMounted(() => {
</script>
<style scoped lang="scss">
.operlog-view-hero {
margin: -4px 0 16px;
padding: 16px 18px;
border-radius: 10px;
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
border: 1px solid #d9e8e2;
}
.operlog-view-hero-main {
h2 {
margin: 0 0 8px;
font-size: 18px;
font-weight: 700;
color: #1e293b;
}
}
.operlog-view-hero-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 8px;
}
.operlog-view-hero-meta {
margin: 0;
font-size: 13px;
color: #64748b;
line-height: 1.5;
.dot {
margin: 0 6px;
}
}
.detail-kv-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
+87 -55
View File
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>职位列表</h2>
<h2 class="title-bar-heading">职位列表</h2>
</div>
<div class="filter-block">
@@ -17,10 +17,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按职位名称、编码模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -37,6 +37,32 @@
<el-icon><Plus /></el-icon>
新增职位
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarBindUsers"
>
<el-icon><User /></el-icon>
关联用户
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button
class="btn-ghost"
type="danger"
@@ -44,8 +70,11 @@
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -74,7 +103,11 @@
min-width="140"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.postName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="postCode"
label="职位编码"
@@ -102,40 +135,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="160"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handlePostBindUsers(row)">
<el-icon><User /></el-icon>
关联用户
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -311,12 +310,34 @@
:icon="Briefcase"
:meta="`职位编码:${viewRow?.postCode || ''}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
/>
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button class="btn-ghost" @click="handlePostBindUsers(viewRow)">
<el-icon><User /></el-icon>
关联用户
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</section>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -325,10 +346,8 @@
Close,
Check,
User,
View,
Edit,
Delete,
More,
Briefcase,
RefreshLeft,
Search
@@ -358,7 +377,7 @@ const dictStore = useDictStore()
const tableData = ref<Api.Post.PostItem[]>([])
const selectedRows = ref<Api.Post.PostItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增职位')
const isEdit = ref(false)
@@ -696,29 +715,42 @@ const dictStore = useDictStore()
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'view':
handleView(row)
break
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条职位')
return
}
handleEdit(selectedRows.value[0])
}
async function handleDelete(row: Api.Post.PostItem)
function handleToolbarBindUsers() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条职位')
return
}
handlePostBindUsers(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条职位')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Post.PostItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
await ElMessageBox.confirm(`确定删除职位「${row.postName}」吗?`, '提示', { type: 'warning' })
await fetchDeletePost(row.id)
ElMessage.success('删除成功')
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await loadData()
}
+106 -56
View File
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>角色列表</h2>
<h2 class="title-bar-heading">角色列表</h2>
</div>
<div class="filter-block">
@@ -17,10 +17,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按角色名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -37,6 +37,40 @@
<el-icon><Plus /></el-icon>
新增角色
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarMenuConfig"
>
<el-icon><Menu /></el-icon>
菜单配置
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarDataScope"
>
<el-icon><DataAnalysis /></el-icon>
数据权限
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button
class="btn-ghost"
type="danger"
@@ -44,8 +78,11 @@
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -74,7 +111,11 @@
min-width="140"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.roleName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="dataScope"
label="数据权限"
@@ -106,42 +147,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="200"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handleMenuConfig(row)"
>菜单配置</el-button
>
<el-button class="btn-op-item primary" @click="handleDataScope(row)"
><el-icon><DataAnalysis /></el-icon>数据权限</el-button
>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -379,6 +384,30 @@
:meta="`数据权限:${dataScopeLabel(viewDataScopeCode || viewRow?.dataScope || '')}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleMenuConfig(viewRow)">
<el-icon><Menu /></el-icon>
菜单配置
</el-button>
<el-button class="btn-ghost" @click="handleDataScope(viewRow)">
<el-icon><DataAnalysis /></el-icon>
数据权限
</el-button>
<el-button class="btn-ghost" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
<template #menuTree>
<div class="role-view-tree-block" v-loading="viewDetailLoading">
<div v-if="viewMenuTreeData.length" class="role-view-tree-scroll">
@@ -422,6 +451,7 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -430,11 +460,10 @@
Close,
Check,
DataAnalysis,
View,
Stamp,
RefreshLeft,
Search,
More,
Menu,
Edit,
Delete
} from '@element-plus/icons-vue'
@@ -472,7 +501,7 @@ const dictStore = useDictStore()
const tableData = ref<Api.Role.RoleItem[]>([])
const selectedRows = ref<Api.Role.RoleItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
// ---- 新增/编辑弹窗 ----
const dialogVisible = ref(false)
@@ -741,28 +770,49 @@ const dictStore = useDictStore()
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'view':
handleView(row)
break
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarMenuConfig() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条角色')
return
}
handleMenuConfig(selectedRows.value[0])
}
async function handleDelete(row: Api.Role.RoleItem)
function handleToolbarDataScope() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条角色')
return
}
handleDataScope(selectedRows.value[0])
}
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条角色')
return
}
handleEdit(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条角色')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Role.RoleItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
await ElMessageBox.confirm(`确定删除角色「${row.roleName}」吗?`, '提示', { type: 'warning' })
await fetchDeleteRole(row.id)
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await loadData()
}
+15 -11
View File
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>站点列表</h2>
<h2 class="title-bar-heading">站点列表</h2>
</div>
<div class="filter-block">
@@ -17,10 +17,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按站点名称、编码模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -44,8 +44,11 @@
:title="allRowsDeletableByCreator(selectedRows) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -74,7 +77,11 @@
min-width="140"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.siteName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="siteCode"
label="站点编码"
@@ -144,9 +151,6 @@
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
@@ -299,10 +303,11 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, computed, onMounted, nextTick } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Close, Check, View, Edit, Delete, More, Location, RefreshLeft, Search } from '@element-plus/icons-vue'
import { Plus, Close, Check, Edit, Delete, More, Location, RefreshLeft, Search } from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import { useDictStore } from '@/store/modules/dict'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
@@ -373,7 +378,7 @@ const dictStore = useDictStore()
const tableData = ref<Api.Site.SiteItem[]>([])
const selectedRows = ref<Api.Site.SiteItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增站点')
const isEdit = ref(false)
@@ -650,12 +655,11 @@ const dictStore = useDictStore()
}
}
async function handleDelete(row: Api.Site.SiteItem)
async function handleDelete(row: Api.Site.SiteItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
await ElMessageBox.confirm(`确定删除站点「${row.siteName}」吗?`, '提示', { type: 'warning' })
await fetchDeleteSite(row.id)
ElMessage.success('删除成功')
+82 -46
View File
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>租户列表</h2>
<h2 class="title-bar-heading">租户列表</h2>
</div>
<div class="filter-block">
@@ -17,10 +17,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按租户编号、名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -37,6 +37,34 @@
<el-icon><Plus /></el-icon>
新增租户
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="
selectedRows.length !== 1 ||
isDefaultTenantRow(selectedRows[0]) ||
!canDeleteByCreator(selectedRows[0])
"
:title="
selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0])
? CREATOR_DELETE_TIP
: selectedRows.length === 1 && isDefaultTenantRow(selectedRows[0])
? '默认租户不可删除'
: ''
"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button
class="btn-ghost"
type="danger"
@@ -44,8 +72,11 @@
:title="allRowsDeletableByCreator(deletableSelection) ? '' : CREATOR_DELETE_TIP"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -99,7 +130,11 @@
min-width="160"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.tenantName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="contactName"
label="联系人"
@@ -121,36 +156,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="isDefaultTenantRow(row) || !canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -223,12 +228,36 @@
:icon="OfficeBuilding"
:meta="viewRow?.createTime || ''"
:sections="viewSections"
/>
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="isDefaultTenantRow(viewRow) || !canDeleteByCreator(viewRow)"
:title="
isDefaultTenantRow(viewRow)
? '默认租户不可删除'
: canDeleteByCreator(viewRow)
? ''
: CREATOR_DELETE_TIP
"
@click="handleDelete(viewRow)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</section>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { ref, reactive, onMounted, computed } from 'vue'
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -236,10 +265,8 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
Plus,
Close,
Check,
View,
Edit,
Delete,
More,
OfficeBuilding,
RefreshLeft,
Search
@@ -262,7 +289,7 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
const tableData = ref<Api.Tenant.TenantItem[]>([])
const selectedRows = ref<Api.Tenant.TenantItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增租户')
const isEdit = ref(false)
@@ -414,15 +441,20 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
viewVisible.value = true
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'edit':
handleEdit(row)
break
case 'delete':
handleDelete(row)
break
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条租户')
return
}
handleEdit(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条租户')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Tenant.TenantItem) {
@@ -436,6 +468,10 @@ import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator
}
await ElMessageBox.confirm(`确定删除租户「${row.tenantName}」吗?`, '提示', { type: 'warning' })
await fetchDeleteTenant(row.id)
if (viewRow.value?.id === row.id) {
viewVisible.value = false
viewRow.value = null
}
await loadData()
}
+90 -21
View File
@@ -8,7 +8,7 @@
<div class="w-[280px] shrink-0 border-r border-[var(--mint-border)] pr-4">
<!-- 标题与搜索同处 panel-top:避免标题栏底边与独立输入框之间出现不可控的视觉断层 -->
<div class="panel-top user-dept-aside__head">
<h2>组织</h2>
<h2 class="title-bar-heading">组织</h2>
<el-input v-model="deptKeyword" placeholder="搜索组织" clearable />
</div>
<el-tree
@@ -27,7 +27,7 @@
<!-- 右侧:用户列表 -->
<div class="flex-1 min-w-0">
<div class="panel-top">
<h2>用户列表</h2>
<h2 class="title-bar-heading">用户列表</h2>
</div>
<div class="filter-block">
@@ -46,10 +46,10 @@
<div class="filter-actions-row">
<span class="filter-hint">支持按关键词、状态筛选。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -74,14 +74,6 @@
<el-icon><Key /></el-icon>
重置密码
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarView"
>
<el-icon><View /></el-icon>
查看
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@@ -100,6 +92,16 @@
<el-icon><Delete /></el-icon>
删除
</el-button>
<ListToolbarEndActions
:loading="loading"
:column-defs="listColumnDefs"
v-model:visible-columns="visibleColumns"
v-model:check-all="checkAll"
:is-indeterminate="isIndeterminate"
@refresh="loadData"
@reset-columns="resetToDefault"
/>
</div>
</div>
@@ -123,6 +125,7 @@
:index="(index: number) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
v-if="isColumnVisible('userNo')"
prop="userNo"
label="用户账号"
min-width="120"
@@ -135,8 +138,13 @@
min-width="100"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.nickName }}</el-link>
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('deptName')"
prop="deptName"
label="所属组织"
min-width="200"
@@ -148,6 +156,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('phoneNo')"
prop="phoneNo"
label="手机号"
min-width="140"
@@ -159,6 +168,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('status')"
prop="status"
label="状态"
min-width="80"
@@ -172,6 +182,7 @@
</template>
</el-table-column>
<el-table-column
v-if="isColumnVisible('createTime')"
prop="createTime"
label="创建时间"
min-width="180"
@@ -288,7 +299,28 @@
:icon="UserFilled"
:meta="`${viewRow?.deptName || ''}${viewRow?.deptName && viewRow?.createTime ? ' · ' : ''}${viewRow?.createTime || ''}`"
:sections="viewSections"
/>
>
<template v-if="viewRow" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleEdit(viewRow)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button class="btn-ghost" @click="handleHeroResetPwd">
<el-icon><Key /></el-icon>
重置密码
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewRow)"
:title="canDeleteByCreator(viewRow) ? '' : CREATOR_DELETE_TIP"
@click="handleHeroDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</section>
</div>
</template>
@@ -301,7 +333,6 @@
Plus,
Close,
Check,
View,
UserFilled,
RefreshLeft,
Search,
@@ -310,6 +341,8 @@
Delete
} from '@element-plus/icons-vue'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
import {
fetchUserList,
fetchUserDetail,
@@ -370,7 +403,23 @@ const dictStore = useDictStore()
const tableData = ref<Api.User.UserItem[]>([])
const selectedRows = ref<Api.User.UserItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const listColumnDefs = [
{ prop: 'userNo', label: '用户账号' },
{ prop: 'deptName', label: '所属组织' },
{ prop: 'phoneNo', label: '手机号' },
{ prop: 'status', label: '状态' },
{ prop: 'createTime', label: '创建时间', defaultVisible: false }
]
const {
visibleColumns,
checkAll,
isIndeterminate,
isColumnVisible,
resetToDefault
} = usePersistedListColumns('system-user-list-columns', listColumnDefs)
const dialogVisible = ref(false)
const dialogTitle = ref('新增用户')
@@ -560,11 +609,6 @@ const dictStore = useDictStore()
return selectedRows.value[0]
}
function handleToolbarView() {
const row = requireSingleSelection('查看')
if (row) handleView(row)
}
function handleToolbarEdit() {
const row = requireSingleSelection('编辑')
if (row) handleEdit(row)
@@ -663,6 +707,31 @@ const dictStore = useDictStore()
ElMessage.error('加载用户详情失败')
}
}
async function handleHeroResetPwd() {
if (!viewRow.value) return
const row = viewRow.value
await ElMessageBox.confirm(`确定将用户「${row.nickName}」的密码重置为 111111 吗?`, '提示', {
type: 'warning'
})
await fetchResetPassword(row.id)
ElMessage.success('密码重置成功')
}
async function handleHeroDelete() {
if (!viewRow.value) return
const row = viewRow.value
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
await ElMessageBox.confirm(`确定删除用户「${row.nickName}」吗?`, '提示', { type: 'warning' })
await fetchDeleteUser(row.id)
ElMessage.success('删除成功')
viewVisible.value = false
viewRow.value = null
await loadData()
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
searchForm,
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>申请列表</h2>
<h2 class="title-bar-heading">申请列表</h2>
</div>
<div class="filter-block">
@@ -33,10 +33,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按流程名称、业务单号模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -44,6 +44,12 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
@@ -68,7 +74,11 @@
align="center"
header-align="center"
show-overflow-tooltip
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="businessTypeLabel"
label="业务类型"
@@ -102,19 +112,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="160"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"
><el-icon><View /></el-icon>查看详情</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -218,16 +215,17 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { fetchMyInstances, fetchBusinessAllTasks } from '@/api/workflow'
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
import { Document, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
defineOptions({ name: 'WorkflowMyApplications' })
const searchForm = reactive<{ keyword: string; status: string }>({ keyword: '', status: '' })
const tableData = ref<Api.Workflow.MyInstanceItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
const detailVisible = ref(false)
const detailLoading = ref(false)
@@ -4,7 +4,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>流程列表</h2>
<h2 class="title-bar-heading">流程列表</h2>
</div>
<div class="filter-block">
@@ -22,10 +22,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按流程名称、编码模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -42,6 +42,32 @@
<el-icon><Plus /></el-icon>
新增流程
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarEdit"
>
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
:disabled="selectedRows.length !== 1"
@click="handleToolbarDesign"
>
<el-icon><SetUp /></el-icon>
流程设计
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length !== 1 || !canDeleteByCreator(selectedRows[0])"
:title="selectedRows.length === 1 && !canDeleteByCreator(selectedRows[0]) ? CREATOR_DELETE_TIP : ''"
@click="handleToolbarDelete"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
<el-button
class="btn-ghost"
type="danger"
@@ -52,6 +78,8 @@
<el-icon><Delete /></el-icon>
批量删除
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
@@ -63,6 +91,7 @@
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
@@ -86,7 +115,12 @@
min-width="180"
align="center"
header-align="center"
/>
show-overflow-tooltip
>
<template #default="{ row }">
<el-link type="primary" @click="handleView(row)">{{ row.processName }}</el-link>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-switch
@@ -109,36 +143,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="160"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item primary" @click="handleDesign(row)">
<el-icon><SetUp /></el-icon>流程设计
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided :disabled="!canDeleteByCreator(row)">
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -204,12 +208,48 @@
:process-name="designerDefName"
@saved="handleDesignerSaved"
/>
<SystemViewDialog
v-model:visible="viewVisible"
:title="viewingRecord?.processName || '流程详情'"
:icon="SetUp"
:code="viewingRecord?.processCode"
code-label="流程编码"
:sections="processViewSections"
>
<template v-if="viewingRecord" #hero-actions>
<el-button class="btn-main" type="primary" @click="handleDesign(viewingRecord)">
<el-icon><SetUp /></el-icon>
流程设计
</el-button>
<el-button class="btn-ghost" @click="handleEdit(viewingRecord)">
<el-icon><Edit /></el-icon>
编辑
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canDeleteByCreator(viewingRecord)"
:title="canDeleteByCreator(viewingRecord) ? '' : CREATOR_DELETE_TIP"
@click="handleDelete(viewingRecord)"
>
<el-icon><Delete /></el-icon>
删除
</el-button>
</template>
</SystemViewDialog>
</div>
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import {
canDeleteByCreator,
filterDeletableByCreator,
allRowsDeletableByCreator,
CREATOR_DELETE_TIP
} from '@/utils/creator-delete'
import {
import { canDeleteByCreator, filterDeletableByCreator, allRowsDeletableByCreator, CREATOR_DELETE_TIP } from '@/utils/creator-delete'
Plus,
Close,
Check,
@@ -217,8 +257,7 @@
RefreshLeft,
Delete,
SetUp,
Edit,
More
Edit
} from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import {
@@ -228,6 +267,10 @@
fetchDeleteProcessDef
} from '@/api/workflow'
import FlowDesigner from '../designer/FlowDesigner.vue'
import SystemViewDialog, {
type ViewField,
type ViewSection
} from '@/components/business/system-view-dialog/index.vue'
defineOptions({ name: 'WorkflowProcess' })
@@ -235,7 +278,7 @@
const tableData = ref<Api.Workflow.ProcessDefItem[]>([])
const selectedRows = ref<Api.Workflow.ProcessDefItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
// 新增/编辑
const dialogVisible = ref(false)
@@ -262,6 +305,31 @@
const designerDefId = ref('')
const designerDefName = ref('')
// 查看
const viewVisible = ref(false)
const viewingRecord = ref<Api.Workflow.ProcessDefItem | null>(null)
const processViewSections = computed<ViewSection[]>(() => {
const row = viewingRecord.value
if (!row) return []
const fields: ViewField[] = [
{ label: '流程编码', value: row.processCode || '--' },
{ label: '流程名称', value: row.processName || '--' },
{
label: '状态',
value: row.status === '1' ? '启用' : '停用',
tagType: row.status === '1' ? 'success' : 'info'
},
{
label: '最新版本',
value: row.latestVersion != null ? `V${row.latestVersion}` : '--'
},
{ label: '创建时间', value: row.createTime || '--' },
{ label: '备注', value: row.remark || '--', colSpan: 2 }
]
return [{ title: '基本信息', fields }]
})
const handleSelectionChange = (rows: Api.Workflow.ProcessDefItem[]) => {
selectedRows.value = rows
}
@@ -353,21 +421,46 @@
await loadData()
}
function handleDropdownCommand(command: string, row: Api.Workflow.ProcessDefItem) {
switch (command) {
case 'edit': handleEdit(row); break
case 'delete': handleDelete(row); break
}
function handleView(row: Api.Workflow.ProcessDefItem) {
viewingRecord.value = row
viewVisible.value = true
}
async function handleDelete(row: Api.Workflow.ProcessDefItem)
function handleToolbarEdit() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条流程')
return
}
handleEdit(selectedRows.value[0])
}
function handleToolbarDesign() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条流程')
return
}
handleDesign(selectedRows.value[0])
}
function handleToolbarDelete() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条流程')
return
}
handleDelete(selectedRows.value[0])
}
async function handleDelete(row: Api.Workflow.ProcessDefItem) {
if (!canDeleteByCreator(row)) {
ElMessage.warning(CREATOR_DELETE_TIP)
return
}
{
await ElMessageBox.confirm('确定要删除该流程吗?', '提示', { type: 'warning' })
await fetchDeleteProcessDef(row.id)
if (viewingRecord.value?.id === row.id) {
viewVisible.value = false
viewingRecord.value = null
}
await loadData()
}
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>已办列表</h2>
<h2 class="title-bar-heading">已办列表</h2>
</div>
<div class="filter-block">
@@ -21,10 +21,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按流程名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -32,6 +32,12 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
@@ -55,7 +61,11 @@
min-width="160"
align="center"
header-align="center"
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="businessTypeLabel"
label="业务类型"
@@ -98,19 +108,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleViewDetail(row)"
><el-icon><View /></el-icon>查看详情</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -216,16 +213,17 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { fetchCompletedTasks, fetchInstanceDetail } from '@/api/workflow'
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
import { Document, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
import { Document, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
defineOptions({ name: 'WorkflowTaskCompleted' })
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const tableData = ref<Api.Workflow.TaskItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
// 详情
const detailVisible = ref(false)
@@ -3,7 +3,7 @@
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2>待办列表</h2>
<h2 class="title-bar-heading">待办列表</h2>
</div>
<div class="filter-block">
@@ -21,10 +21,10 @@
<div class="filter-actions-row">
<span class="filter-hint">按流程名称模糊查询。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
<el-button class="btn-ghost" :loading="loading" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
<el-button class="btn-main" type="primary" :loading="loading" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
@@ -32,6 +32,25 @@
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button
class="btn-main"
type="primary"
:disabled="selectedRows.length !== 1"
@click="handleToolbarApprove"
>
<el-icon><EditPen /></el-icon>
审批
</el-button>
<ListToolbarEndActions :loading="loading" @refresh="loadData" />
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
@@ -39,8 +58,10 @@
v-loading="loading"
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleViewDetail"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
@@ -56,7 +77,11 @@
align="center"
header-align="center"
show-overflow-tooltip
/>
>
<template #default="{ row }">
<el-link type="primary" @click="handleViewDetail(row)">{{ row.processName }}</el-link>
</template>
</el-table-column>
<el-table-column
prop="businessTypeLabel"
label="业务类型"
@@ -86,22 +111,6 @@
align="center"
header-align="center"
/>
<el-table-column
label="操作"
min-width="260"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-button class="btn-op-item primary" @click="handleApprove(row)"
><el-icon><EditPen /></el-icon>审批</el-button
>
<el-button class="btn-op-item" @click="handleViewDetail(row)"
><el-icon><View /></el-icon>查看详情</el-button
>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
@@ -156,6 +165,12 @@
{{ detailData.createTime || '--' }}
</p>
</div>
<div v-if="viewingRow" class="view-hero-actions">
<el-button class="btn-main" type="primary" @click="handleApprove(viewingRow)">
<el-icon><EditPen /></el-icon>
审批
</el-button>
</div>
</div>
<div
@@ -215,17 +230,19 @@
</template>
<script setup lang="ts">
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
import { fetchPendingTasks, fetchInstanceDetail } from '@/api/workflow'
import ApprovalDialog from '../components/ApprovalDialog.vue'
import ProcessStatusTag from '../components/ProcessStatusTag.vue'
import { Document, EditPen, View, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
import { Document, EditPen, Search, RefreshLeft, Close } from '@element-plus/icons-vue'
defineOptions({ name: 'WorkflowTaskPending' })
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const tableData = ref<Api.Workflow.TaskItem[]>([])
const selectedRows = ref<Api.Workflow.TaskItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const pagination = reactive({ page: 1, pageSize: 20, total: 0 })
// 审批
const approvalVisible = ref(false)
@@ -236,6 +253,11 @@
const detailVisible = ref(false)
const detailLoading = ref(false)
const detailData = ref<Api.Workflow.InstanceDetail | null>(null)
const viewingRow = ref<Api.Workflow.TaskItem | null>(null)
function handleSelectionChange(rows: Api.Workflow.TaskItem[]) {
selectedRows.value = rows
}
async function loadData() {
loading.value = true
@@ -263,6 +285,14 @@
loadData()
}
function handleToolbarApprove() {
if (selectedRows.value.length !== 1) {
ElMessage.warning('请选择一条待办任务')
return
}
handleApprove(selectedRows.value[0])
}
function handleApprove(row: Api.Workflow.TaskItem) {
approvalTaskId.value = row.id
approvalInstanceId.value = row.instanceId || ''
@@ -274,6 +304,7 @@
}
async function handleViewDetail(row: Api.Workflow.TaskItem) {
viewingRow.value = row
detailVisible.value = true
detailLoading.value = true
detailData.value = null
@@ -336,6 +367,16 @@
background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 55%);
border-bottom: 1px solid #d9e8e2;
align-items: center;
flex-wrap: wrap;
}
.view-hero-actions {
margin-left: auto;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: 8px;
flex-shrink: 0;
}
.view-hero-icon {