This commit is contained in:
BianLzhaoMin 2025-12-30 17:06:29 +08:00
parent 8d2a29a0d4
commit d1143648bc
16 changed files with 284 additions and 122 deletions

View File

@ -186,23 +186,43 @@
<template #default="{ row, $index }">
<slot name="action" :row="row" :index="$index">
<!-- 前3个按钮直接显示 -->
<ComButton
v-for="(action, idx) in visibleActions"
:key="idx"
:type="action.type || 'primary'"
:size="
computedSize === 'large'
? 'default'
: computedSize === 'small'
? 'small'
: 'small'
"
:link="action.link !== false"
:plain="action.plain"
@click="handleAction(action, row, $index)"
>
{{ action.label }}
</ComButton>
<template v-for="(action, idx) in visibleActions" :key="idx">
<!-- 有权限配置的按钮使用 v-hasPermi 指令 -->
<ComButton
v-if="action.permission"
:type="action.type || 'primary'"
:size="
computedSize === 'large'
? 'default'
: computedSize === 'small'
? 'small'
: 'small'
"
:link="action.link !== false"
:plain="action.plain"
@click="handleAction(action, row, $index)"
v-hasPermi="action.permission"
>
{{ action.label }}
</ComButton>
<!-- 没有权限配置的按钮不使用 v-hasPermi 指令兼容旧代码 -->
<ComButton
v-else
:type="action.type || 'primary'"
:size="
computedSize === 'large'
? 'default'
: computedSize === 'small'
? 'small'
: 'small'
"
:link="action.link !== false"
:plain="action.plain"
@click="handleAction(action, row, $index)"
>
{{ action.label }}
</ComButton>
</template>
<!-- 超过3个按钮时使用下拉菜单 -->
<el-dropdown
v-if="moreActions.length > 0"
@ -218,13 +238,23 @@
</ComButton>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item
v-for="(action, idx) in moreActions"
:key="idx"
:command="{ action, row, index: $index }"
>
{{ action.label }}
</el-dropdown-item>
<template v-for="(action, idx) in moreActions" :key="idx">
<!-- 有权限配置的菜单项使用 v-hasPermi 指令 -->
<el-dropdown-item
v-if="action.permission"
:command="{ action, row, index: $index }"
v-hasPermi="action.permission"
>
{{ action.label }}
</el-dropdown-item>
<!-- 没有权限配置的菜单项不使用 v-hasPermi 指令兼容旧代码 -->
<el-dropdown-item
v-else
:command="{ action, row, index: $index }"
>
{{ action.label }}
</el-dropdown-item>
</template>
</el-dropdown-menu>
</template>
</el-dropdown>

View File

@ -2,6 +2,7 @@ import { defineStore } from 'pinia'
const useOptionsStore = defineStore('options', {
state: () => ({
allPositionAndInspectionStationOptions: [], // 运检站和岗位在一起的选项
positionOptions: [], // 人员岗位
personNatureOptions: [], // 人员性质
personCategoryOptions: [], // 人员分类

View File

@ -122,6 +122,7 @@ const actionColumns = [
if (result.code === 200) {
proxy.$modal.msgSuccess('删除成功')
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'inspectionStationOptions') //
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'allPositionAndInspectionStationOptions') //
comTableRef.value?.refresh() //
}
})
@ -160,6 +161,7 @@ const onHandleSave = async () => {
if (result.code === 200) {
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'inspectionStationOptions') //
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'allPositionAndInspectionStationOptions')
addAndEditFormRef.value.resetFields() //
dialogConfig.outerVisible = false
comTableRef.value?.refresh() //

View File

@ -121,6 +121,7 @@ const actionColumns = [
if (result.code === 200) {
proxy.$modal.msgSuccess('删除成功')
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'positionOptions')
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'allPositionAndInspectionStationOptions')
comTableRef.value?.refresh() //
}
})
@ -159,6 +160,7 @@ const onHandleSave = async () => {
if (result.code === 200) {
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'positionOptions') //
bus.emit(BUS_EVENTS.REFRESH_OPTIONS, 'allPositionAndInspectionStationOptions')
addAndEditFormRef.value.resetFields() //
dialogConfig.outerVisible = false
comTableRef.value?.refresh() //

View File

@ -42,7 +42,12 @@
<div class="card-header">
{{ reportTitle }}
</div>
<ComButton type="primary" icon="Download" @click="onDownload">
<ComButton
type="primary"
icon="Download"
@click="onDownload"
v-hasPermi="['monthReport:monthlyReport:download']"
>
下载
</ComButton>
</div>

View File

@ -11,7 +11,14 @@
:action-columns="actionColumns"
>
<template #toolbar>
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建人员</ComButton>
<ComButton
type="primary"
icon="Plus"
@click="onHandleAdd"
v-hasPermi="['person:person:add']"
>
新建人员
</ComButton>
</template>
<template #longTermSecondment="{ row }">
<el-switch
@ -29,7 +36,7 @@
<AddAndEditForm
ref="formRef"
:form-data="addAndEditForm"
:inspection-station-options="inspectionStationOptions"
:inspection-station-options="allPositionAndInspectionStationOptions"
:position-options="positionOptions"
:nature-options="natureOptions"
:category-options="categoryOptions"
@ -63,7 +70,7 @@ import ComTable from '@/components/ComTable/index.vue'
import ComButton from '@/components/ComButton/index.vue'
import ComDialog from '@/components/ComDialog/index.vue'
import AddAndEditForm from './addAndEditForm.vue'
import CryptoUtil from "../../../api/crypto.js";
import CryptoUtil from '../../../api/crypto.js'
const { tableColumns, dialogConfig, buildFormColumns } = config
const { proxy } = getCurrentInstance()
@ -73,11 +80,18 @@ const comTableRef = ref(null)
const editId = ref(null)
// 使 Hook
const { options: inspectionStationOptions } = useOptions(
'inspectionStationOptions',
// const { options: inspectionStationOptions } = useOptions(
// 'inspectionStationOptions',
// getInspectionStationSelectAPI,
// {},
// )
const { options: allPositionAndInspectionStationOptions } = useOptions(
'allPositionAndInspectionStationOptions',
getInspectionStationSelectAPI,
{},
)
const { options: positionOptions } = useOptions(
'positionOptions',
getPersonNatureAndCategoryAndPositionSelectAPI,
@ -118,6 +132,7 @@ const actionColumns = [
label: '编辑',
type: 'primary',
link: true,
permission: ['person:person:edit'], // 使 v-hasPermi
handler: (row) => {
editId.value = row.id
dialogConfig.outerTitle = '编辑人员'
@ -137,7 +152,7 @@ const actionColumns = [
Object.assign(addAndEditForm.value, {
inspectionStationId: inspectionStationId + '',
name,
phone:CryptoUtil.decrypt(phone),
phone: CryptoUtil.decrypt(phone),
sex: sex * 1,
positionId: positionId + '',
personnelNatureId: personnelNatureId + '',
@ -151,6 +166,7 @@ const actionColumns = [
label: '删除',
type: 'danger',
link: true,
permission: ['person:person:remove'], // 使 v-hasPermi
handler: (row) => {
proxy.$modal.confirm('是否确认删除该人员?').then(async () => {
const result = await delPersonAPI({ id: row.id })

View File

@ -7,7 +7,13 @@
<el-radio-button label="项目部" value="2" />
</el-radio-group>
<ComButton type="info" plain icon="Download" @click="onDownloadStatistic">
<ComButton
type="info"
plain
icon="Download"
@click="onDownloadStatistic"
v-hasPermi="['plan:dailyPlan:downloadStatistic']"
>
下载统计表
</ComButton>
</el-card>
@ -38,13 +44,21 @@
</span>
</template>
<template #toolbar>
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新增日计划</ComButton>
<ComButton
type="primary"
icon="Plus"
@click="onHandleAdd"
v-hasPermi="['plan:dailyPlan:add']"
>
新增日计划
</ComButton>
<ComButton
plain
type="info"
icon="Download"
@click="onDownloadWorkloadSummary"
v-if="['1', '2'].includes(tableType)"
v-hasPermi="['plan:dailyPlan:downloadWorkloadSummary']"
>
下载工作量统计表
</ComButton>
@ -167,6 +181,7 @@ const actionColumns = computed(() => [
label: '详情',
type: 'primary',
link: true,
permission: ['plan:dailyPlan:detail'], // 使 v-hasPermi
handler: (row) => {
router.push({
path: '/plan/dailyPlanEdit/index',
@ -186,6 +201,7 @@ const actionColumns = computed(() => [
label: '编辑',
type: 'primary',
link: true,
permission: ['plan:dailyPlan:edit'], // 使 v-hasPermi
handler: (row) => {
router.push({
path: '/plan/dailyPlanEdit/index',
@ -205,6 +221,7 @@ const actionColumns = computed(() => [
label: '删除',
type: 'danger',
link: true,
permission: ['plan:dailyPlan:remove'], // 使 v-hasPermi
handler: (row) => {
proxy.$modal.confirm('是否确认删除该日计划?').then(async () => {
const result = await delDailyPlanAPI({ dayPlanId: row.dayPlanId })

View File

@ -11,12 +11,20 @@
:action-columns="actionColumns"
>
<template #toolbar="{ formData }">
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新增月计划</ComButton>
<ComButton
type="primary"
icon="Plus"
@click="onHandleAdd"
v-hasPermi="['plan:monthlyPlan:add']"
>
新增月计划
</ComButton>
<ComButton
type="info"
plain
icon="UploadFilled"
@click="onExportPersonArrange(formData)"
v-hasPermi="['plan:monthlyPlan:exportPersonArrange']"
>
导出人员安排表
</ComButton>
@ -25,6 +33,7 @@
plain
icon="UploadFilled"
@click="onExportOverallSummary(formData)"
v-hasPermi="['plan:monthlyPlan:exportOverallSummary']"
>
导出整体汇总表
</ComButton>
@ -33,6 +42,7 @@
plain
icon="UploadFilled"
@click="onExportWorkloadSummary(formData)"
v-hasPermi="['plan:monthlyPlan:exportWorkloadSummary']"
>
导出工作量汇总表
</ComButton>
@ -149,6 +159,7 @@ const actionColumns = [
label: '详情',
type: 'primary',
link: true,
permission: ['plan:monthlyPlan:detail'], // 使 v-hasPermi
handler: (row) => {
const {
monthlyPlanId,
@ -176,6 +187,7 @@ const actionColumns = [
label: '编辑',
type: 'primary',
link: true,
permission: ['plan:monthlyPlan:edit'], // 使 v-hasPermi
handler: (row) => {
const {
monthlyPlanId,
@ -202,6 +214,7 @@ const actionColumns = [
label: '删除',
type: 'danger',
link: true,
permission: ['plan:monthlyPlan:remove'], // 使 v-hasPermi
handler: (row) => {
proxy.$modal.confirm('是否确认删除该月计划?').then(async () => {
const result = await delMonthlyPlanAPI({ monthlyPlanId: row.monthlyPlanId })

View File

@ -11,8 +11,21 @@
:action-columns="actionColumns"
>
<template #toolbar>
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建计划</ComButton>
<ComButton type="info" icon="Upload" pain @click="onHandleImport">
<ComButton
type="primary"
icon="Plus"
@click="onHandleAdd"
v-hasPermi="['plan:plan:add']"
>
新建计划
</ComButton>
<ComButton
pain
type="info"
icon="Upload"
@click="onHandleImport"
v-hasPermi="['plan:plan:import']"
>
导入计划
</ComButton>
</template>
@ -217,6 +230,7 @@ const actionColumns = [
label: '删除',
type: 'danger',
link: true,
permission: ['plan:plan:remove'], // 使 v-hasPermi
handler: (row) => {
proxy.$modal.confirm('是否确认删除该计划?').then(async () => {
const result = await delPlanAPI({

View File

@ -90,7 +90,12 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="dataList"
@selection-change="handleSelectionChange"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编码" align="center" prop="dictCode" />
<el-table-column label="字典标签" align="center" prop="dictLabel">

View File

@ -112,7 +112,12 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="typeList"
@selection-change="handleSelectionChange"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" />
<el-table-column

View File

@ -53,7 +53,12 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="userList"
@selection-change="handleSelectionChange"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />

View File

@ -102,7 +102,12 @@
</el-row>
<!-- 表格数据 -->
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="roleList"
@selection-change="handleSelectionChange"
border
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column

View File

@ -33,6 +33,7 @@
:data="userList"
@selection-change="handleSelectionChange"
height="260px"
border
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column

View File

@ -1,52 +1,70 @@
<template>
<div class="app-container">
<h4 class="form-header h4">基本信息</h4>
<el-form :model="form" label-width="80px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" disabled />
</el-form-item>
</el-col>
<el-col :span="8" :offset="2">
<el-form-item label="登录账号" prop="userName">
<el-input v-model="form.userName" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="app-container">
<h4 class="form-header h4">基本信息</h4>
<el-form :model="form" label-width="80px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" disabled />
</el-form-item>
</el-col>
<el-col :span="8" :offset="2">
<el-form-item label="登录账号" prop="userName">
<el-input v-model="form.userName" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<h4 class="form-header h4">角色信息</h4>
<el-table v-loading="loading" :row-key="getRowKey" @row-click="clickRow" ref="roleRef" @selection-change="handleSelectionChange" :data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)">
<el-table-column label="序号" width="55" type="index" align="center">
<template #default="scope">
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column type="selection" :reserve-selection="true" :selectable="checkSelectable" width="55"></el-table-column>
<el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<h4 class="form-header h4">角色信息</h4>
<el-table
v-loading="loading"
:row-key="getRowKey"
@row-click="clickRow"
ref="roleRef"
@selection-change="handleSelectionChange"
:data="roles.slice((pageNum - 1) * pageSize, pageNum * pageSize)"
border
>
<el-table-column label="序号" width="55" type="index" align="center">
<template #default="scope">
<span>{{ (pageNum - 1) * pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column
type="selection"
:reserve-selection="true"
:selectable="checkSelectable"
width="55"
></el-table-column>
<el-table-column label="角色编号" align="center" prop="roleId" />
<el-table-column label="角色名称" align="center" prop="roleName" />
<el-table-column label="权限字符" align="center" prop="roleKey" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="pageNum" v-model:limit="pageSize" />
<pagination
v-show="total > 0"
:total="total"
v-model:page="pageNum"
v-model:limit="pageSize"
/>
<el-form label-width="100px">
<div style="text-align: center;margin-left:-120px;margin-top:30px;">
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="close()">返回</el-button>
</div>
</el-form>
</div>
<el-form label-width="100px">
<div style="text-align: center; margin-left: -120px; margin-top: 30px">
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="close()">返回</el-button>
</div>
</el-form>
</div>
</template>
<script setup name="AuthRole">
import { getAuthRole, updateAuthRole } from "@/api/system/user"
import { getAuthRole, updateAuthRole } from '@/api/system/user'
const route = useRoute()
const { proxy } = getCurrentInstance()
@ -58,66 +76,66 @@ const pageSize = ref(10)
const roleIds = ref([])
const roles = ref([])
const form = ref({
nickName: undefined,
userName: undefined,
userId: undefined
nickName: undefined,
userName: undefined,
userId: undefined,
})
/** 单击选中行数据 */
function clickRow(row) {
if (checkSelectable(row)) {
proxy.$refs["roleRef"].toggleRowSelection(row)
}
if (checkSelectable(row)) {
proxy.$refs['roleRef'].toggleRowSelection(row)
}
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
roleIds.value = selection.map(item => item.roleId)
roleIds.value = selection.map((item) => item.roleId)
}
/** 保存选中的数据编号 */
function getRowKey(row) {
return row.roleId
return row.roleId
}
//
function checkSelectable(row) {
return row.status === "0" ? true : false
return row.status === '0' ? true : false
}
/** 关闭按钮 */
function close() {
const obj = { path: "/system/user" }
proxy.$tab.closeOpenPage(obj)
const obj = { path: '/system/user' }
proxy.$tab.closeOpenPage(obj)
}
/** 提交按钮 */
function submitForm() {
const userId = form.value.userId
const rIds = roleIds.value.join(",")
updateAuthRole({ userId: userId, roleIds: rIds }).then(response => {
proxy.$modal.msgSuccess("授权成功")
close()
})
const userId = form.value.userId
const rIds = roleIds.value.join(',')
updateAuthRole({ userId: userId, roleIds: rIds }).then((response) => {
proxy.$modal.msgSuccess('授权成功')
close()
})
}
(() => {
const userId = route.params && route.params.userId
if (userId) {
loading.value = true
getAuthRole(userId).then(response => {
form.value = response.user
roles.value = response.roles
total.value = roles.value.length
nextTick(() => {
roles.value.forEach(row => {
if (row.flag) {
proxy.$refs["roleRef"].toggleRowSelection(row)
}
;(() => {
const userId = route.params && route.params.userId
if (userId) {
loading.value = true
getAuthRole(userId).then((response) => {
form.value = response.user
roles.value = response.roles
total.value = roles.value.length
nextTick(() => {
roles.value.forEach((row) => {
if (row.flag) {
proxy.$refs['roleRef'].toggleRowSelection(row)
}
})
})
loading.value = false
})
})
loading.value = false
})
}
}
})()
</script>

View File

@ -3,7 +3,7 @@
<el-row :gutter="20">
<splitpanes :horizontal="appStore.device === 'mobile'" class="default-theme">
<!--部门数据-->
<pane size="16">
<!-- <pane size="16">
<el-col>
<div class="head-container">
<el-input
@ -28,9 +28,9 @@
/>
</div>
</el-col>
</pane>
</pane> -->
<!--用户数据-->
<pane size="84">
<pane size="100">
<el-col>
<el-form
:model="queryParams"
@ -153,6 +153,7 @@
<el-table
v-loading="loading"
:data="userList"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="50" align="center" />
@ -183,7 +184,7 @@
label="部门"
align="center"
key="deptName"
prop="dept.deptName"
prop="deptName"
v-if="columns.deptName.visible"
:show-overflow-tooltip="true"
/>
@ -315,7 +316,7 @@
</el-col>
<el-col :span="12">
<el-form-item label="归属部门" prop="deptId">
<el-tree-select
<!-- <el-tree-select
v-model="form.deptId"
:data="enabledDeptOptions"
:props="{ value: 'id', label: 'label', children: 'children' }"
@ -323,7 +324,19 @@
placeholder="请选择归属部门"
clearable
check-strictly
/>
/> -->
<el-select
v-model="form.deptId"
placeholder="请选择归属部门"
clearable
>
<el-option
:key="item.id"
:value="item.id * 1"
:label="item.value"
v-for="item in allPositionAndInspectionStationOptions"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
@ -511,7 +524,9 @@ import {
addUser,
deptTreeSelect,
} from '@/api/system/user'
import { getInspectionStationSelectAPI } from '@/api/common.js'
import { Splitpanes, Pane } from 'splitpanes'
import { useOptions } from '@/hooks/useOptions'
import 'splitpanes/dist/splitpanes.css'
import CryptoUtil from '../../../api/crypto.js'
import ComDialog from '@/components/ComDialog/index.vue'
@ -522,6 +537,12 @@ const appStore = useAppStore()
const { proxy } = getCurrentInstance()
const { sys_normal_disable, sys_user_sex } = proxy.useDict('sys_normal_disable', 'sys_user_sex')
const { options: allPositionAndInspectionStationOptions } = useOptions(
'allPositionAndInspectionStationOptions',
getInspectionStationSelectAPI,
{},
)
const userList = ref([])
const loading = ref(true)
const showSearch = ref(true)
@ -898,6 +919,7 @@ function handleUpdate(row) {
/** 提交按钮 */
function submitForm() {
proxy.$refs['userRef'].validate((valid) => {
form.value.deptId === undefined ? (form.value.deptId = '') : null
if (valid) {
if (form.value.userId != undefined) {
updateUser(form.value).then((response) => {
@ -917,6 +939,7 @@ function submitForm() {
}
function phoneDes(prm) {
if (!prm) return ''
return CryptoUtil.decrypt(prm)
}
onMounted(() => {