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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -112,7 +112,12 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </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 type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" /> <el-table-column label="字典编号" align="center" prop="dictId" />
<el-table-column <el-table-column

View File

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

View File

@ -102,7 +102,12 @@
</el-row> </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 type="selection" width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" /> <el-table-column label="角色编号" prop="roleId" width="120" />
<el-table-column <el-table-column

View File

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

View File

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

View File

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