+
-
-
+
+
-
+
+
+
+
@@ -38,51 +46,16 @@
style="width: 100%"
v-loading="loading"
>
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ {{ formatDateTime(scope.row.logWritetime) }}
+
+
+
编辑
@@ -108,48 +81,42 @@
v-model="drawerVisible"
:title="drawerTitle"
direction="rtl"
- :size="520"
+ :size="500"
>
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
-
-
+
@@ -188,17 +155,16 @@ import {
} from '@/api/manage-log'
interface LogItem {
- id?: number | string
- operator?: string
- operationType?: string
- operationContent?: string
- module?: string
- ipAddress?: string
- operationTime?: string
+ id?: string | number
+ logName: string
+ logType: string
+ logContent: string
+ logWritetime?: string
remark?: string
- remarks?: string
+ createId?: string
createTime?: string
updateTime?: string
+ updateId?: string
}
const loading = ref(false)
@@ -207,8 +173,9 @@ const tableData = ref([])
const total = ref(0)
const queryForm = reactive({
- operator: '',
- operationType: '',
+ logName: '',
+ logType: '',
+ createId: '',
})
const pagination = reactive({
@@ -223,102 +190,84 @@ const isEdit = ref(false)
const formRef = ref()
const form = reactive({
id: undefined,
- operator: '',
- operationType: '',
- operationContent: '',
- module: '',
- ipAddress: '',
- operationTime: '',
+ logName: '',
+ logType: '',
+ logContent: '',
+ logWritetime: '',
remark: '',
})
const rules: FormRules = {
- operator: [{ required: true, message: '请输入操作人', trigger: 'blur' }],
- operationType: [{ required: true, message: '请输入操作类型', trigger: 'blur' }],
- operationContent: [{ required: true, message: '请输入操作内容', trigger: 'blur' }],
+ logName: [{ required: true, message: '请输入日志名称', trigger: 'blur' }],
+ logType: [{ required: true, message: '请输入日志类型', trigger: 'blur' }],
+ logContent: [{ required: true, message: '请输入日志内容', trigger: 'blur' }],
+ logWritetime: [{ required: true, message: '请选择日志记录时间', trigger: 'change' }],
+}
+
+const formatDateTime = (dateTime?: string) => {
+ if (!dateTime) return '-'
+ try {
+ const date = new Date(dateTime)
+ const year = date.getFullYear()
+ const month = String(date.getMonth() + 1).padStart(2, '0')
+ const day = String(date.getDate()).padStart(2, '0')
+ const hours = String(date.getHours()).padStart(2, '0')
+ const minutes = String(date.getMinutes()).padStart(2, '0')
+ const seconds = String(date.getSeconds()).padStart(2, '0')
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+ } catch {
+ return dateTime
+ }
}
const resetForm = () => {
form.id = undefined
- form.operator = ''
- form.operationType = ''
- form.operationContent = ''
- form.module = ''
- form.ipAddress = ''
- form.operationTime = ''
+ form.logName = ''
+ form.logType = ''
+ form.logContent = ''
+ form.logWritetime = ''
form.remark = ''
formRef.value?.clearValidate()
}
-const formatCell = (_row: any, _column: any, value: any) => {
- if (value === 0) return 0
- return value === undefined || value === null || value === '' ? '暂无' : value
-}
-
const loadList = async () => {
loading.value = true
try {
- // 构建查询参数,过滤空字符串
const params: any = {
pageNum: pagination.pageNum,
pageSize: pagination.pageSize,
}
- if (queryForm.operator && queryForm.operator.trim()) {
- params.operator = queryForm.operator.trim()
- }
- if (queryForm.operationType && queryForm.operationType.trim()) {
- params.operationType = queryForm.operationType.trim()
- }
+ // 只添加有值的查询参数
+ if (queryForm.logName) params.logName = queryForm.logName
+ if (queryForm.logType) params.logType = queryForm.logType
+ if (queryForm.createId) params.createId = queryForm.createId
+
const res: any = await manageloglist(params)
-
- console.log('操作日志列表API返回数据:', res)
-
- // 根据返回格式处理数据
- let pageData = res?.data
-
- // 如果res.data不存在,可能是直接返回了分页数据
- if (!pageData && (res?.records || res?.total !== undefined)) {
- pageData = res
- }
-
- // 兼容多种返回格式
+ const data = res?.data ?? res ?? {}
+
+ // 兼容多种返回格式:{data:{records,total}} | {records,total} | {data:[]} | []
const recordsFromData =
- pageData?.records ||
- pageData?.list ||
- pageData?.rows ||
- pageData?.items ||
- (Array.isArray(pageData?.data) ? pageData.data : undefined)
+ data.records ||
+ data.list ||
+ data.rows ||
+ data.items ||
+ (Array.isArray(data.data) ? data.data : undefined)
const records = Array.isArray(recordsFromData)
? recordsFromData
- : Array.isArray(pageData)
- ? pageData
- : Array.isArray(res?.data)
- ? res.data
- : []
+ : Array.isArray(data)
+ ? data
+ : []
const totalValue =
- pageData?.total ??
- pageData?.count ??
- pageData?.totalCount ??
- res?.total ??
- (Array.isArray(records) ? records.length : 0)
+ data.total ?? data.count ?? data.totalCount ?? records.length ?? 0
tableData.value = records
total.value = Number(totalValue) || 0
-
- console.log('解析后的数据:', {
- records: records.length,
- total: total.value,
- firstRecord: records[0]
- })
- } catch (error: any) {
+ } catch (error) {
console.error('load log list error', error)
- const errorMsg = error?.message || error?.msg || '加载操作日志列表失败'
- ElMessage.error(errorMsg)
- tableData.value = []
- total.value = 0
+ ElMessage.error('获取日志列表失败')
} finally {
loading.value = false
}
@@ -330,8 +279,9 @@ const handleSearch = () => {
}
const resetSearch = () => {
- queryForm.operator = ''
- queryForm.operationType = ''
+ queryForm.logName = ''
+ queryForm.logType = ''
+ queryForm.createId = ''
handleSearch()
}
@@ -356,18 +306,11 @@ const openDrawer = async (mode: 'create' | 'edit', row?: LogItem) => {
const res: any = await managelogbyid(row.id)
const data = res?.data || res || {}
form.id = data.id ?? row.id
- form.operator = data.operator ?? row.operator ?? ''
- form.operationType = data.operationType ?? row.operationType ?? ''
- form.operationContent = data.operationContent ?? row.operationContent ?? ''
- form.module = data.module ?? row.module ?? ''
- form.ipAddress = data.ipAddress ?? row.ipAddress ?? ''
- form.operationTime = data.operationTime ?? row.operationTime ?? ''
- form.remark =
- data.remark ??
- data.remarks ??
- row.remark ??
- (row as any)?.remarks ??
- ''
+ form.logName = data.logName ?? row.logName ?? ''
+ form.logType = data.logType ?? row.logType ?? ''
+ form.logContent = data.logContent ?? row.logContent ?? ''
+ form.logWritetime = data.logWritetime ?? row.logWritetime ?? ''
+ form.remark = data.remark ?? row.remark ?? ''
} catch (error) {
ElMessage.error('获取日志详情失败')
drawerVisible.value = false
@@ -375,28 +318,67 @@ const openDrawer = async (mode: 'create' | 'edit', row?: LogItem) => {
}
}
+// 将时间格式转换为ISO 8601格式
+const formatToISO = (dateTime?: string) => {
+ if (!dateTime) return new Date().toISOString()
+ try {
+ // 如果已经是ISO格式,直接返回
+ if (dateTime.includes('T') && dateTime.includes('Z')) {
+ return dateTime
+ }
+ // 如果是其他格式,转换为ISO格式
+ const date = new Date(dateTime)
+ return date.toISOString()
+ } catch {
+ return new Date().toISOString()
+ }
+}
+
const submitForm = () => {
formRef.value?.validate(async (valid) => {
if (!valid) return
submitLoading.value = true
try {
- const payload: any = {
- ...form,
- remarks: form.remark,
+ // 获取当前时间(ISO 8601格式)
+ const now = new Date().toISOString()
+
+ // 获取用户ID(可以从localStorage或其他地方获取,这里先设为0)
+ const userId = 0 // 可以根据实际情况从用户store或localStorage获取
+
+ // 准备提交数据,按照后端Swagger要求补充所有字段
+ const submitData: any = {
+ logName: form.logName,
+ logType: form.logType,
+ logContent: form.logContent || '',
+ remark: form.remark || '',
+ logWritetime: formatToISO(form.logWritetime),
+ createId: userId,
+ updateId: userId,
+ createTime: now,
+ updateTime: now,
+ delSign: false, // 新增时delSign为false
+ }
+
+ // 如果是编辑,需要包含id
+ if (isEdit.value && form.id) {
+ submitData.id = Number(form.id)
+ } else {
+ // 新增时id设为0
+ submitData.id = 0
}
if (isEdit.value) {
- await managelogupd(payload)
+ await managelogupd(submitData)
ElMessage.success('更新成功')
} else {
- await managelogadd(payload)
+ await managelogadd(submitData)
ElMessage.success('新增成功')
}
drawerVisible.value = false
loadList()
} catch (error: any) {
console.error('submit log error', error)
- const errorMsg = error?.message || error?.msg || (isEdit.value ? '更新失败' : '新增失败')
+ const errorMsg = error?.response?.data?.message || error?.message || (isEdit.value ? '更新失败' : '新增失败')
ElMessage.error(errorMsg)
} finally {
submitLoading.value = false
@@ -409,7 +391,7 @@ const handleDelete = (row: LogItem) => {
ElMessage.warning('缺少日志ID')
return
}
- ElMessageBox.confirm(`确认删除操作日志吗?`, '提示', {
+ ElMessageBox.confirm(`确认删除日志「${row.logName}」吗?`, '提示', {
type: 'warning',
})
.then(async () => {
@@ -421,10 +403,9 @@ const handleDelete = (row: LogItem) => {
await managelogdel(row.id)
ElMessage.success('删除成功')
loadList()
- } catch (error: any) {
+ } catch (error) {
console.error('delete log error', error)
- const errorMsg = error?.message || error?.msg || '删除失败'
- ElMessage.error(errorMsg)
+ ElMessage.error('删除失败')
}
})
.catch(() => {})
@@ -436,7 +417,7 @@ onMounted(() => {
From 2e9ec4b50f7e8c25c97fecdef0ea71064f194249 Mon Sep 17 00:00:00 2001
From: Lxq <19852720163@163.com>
Date: Fri, 19 Dec 2025 14:59:24 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=83=A8=E9=97=A8?=
=?UTF-8?q?=E7=AE=A1=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
rc_autoplc_front/src/api/user.ts | 8 ++++
.../src/views/department/index.vue | 43 +++++++++++++------
rc_autoplc_front/src/views/user/index.vue | 6 +--
3 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/rc_autoplc_front/src/api/user.ts b/rc_autoplc_front/src/api/user.ts
index 6a3ea39..9c032ef 100644
--- a/rc_autoplc_front/src/api/user.ts
+++ b/rc_autoplc_front/src/api/user.ts
@@ -31,6 +31,14 @@ export function userlist(data: any) {
})
}
+export function userselect(data: any) {
+ return request({
+ url: '/user/list',
+ method: 'get',
+ params: data,
+ })
+}
+
export function userbyid(id: string | number) {
return request({
url: `/user/getById/${id}`,
diff --git a/rc_autoplc_front/src/views/department/index.vue b/rc_autoplc_front/src/views/department/index.vue
index 6cec064..a19370f 100644
--- a/rc_autoplc_front/src/views/department/index.vue
+++ b/rc_autoplc_front/src/views/department/index.vue
@@ -88,10 +88,10 @@
:formatter="formatCell"
/>
@@ -160,13 +160,13 @@
v-model="form.leaderId"
filterable
clearable
- placeholder="请选择部门领导(可选)"
+ placeholder="请选择部门领导"
style="width: 100%"
>
@@ -206,6 +206,7 @@ import {
departmentdel,
departtree,
} from '@/api/department'
+import { userselect } from '@/api/user'
interface DeptItem {
id?: number | string
@@ -227,6 +228,7 @@ interface UserItem {
username?: string
realName?: string
nickName?: string
+ nicke?: string
name?: string
}
@@ -285,6 +287,18 @@ const formatCell = (_row: any, _column: any, value: any) => {
return value === undefined || value === null || value === '' ? '暂无' : value
}
+// 根据leaderId获取用户的nicke字段
+const getLeaderNicke = (leaderId: number | string | null | undefined): string => {
+ if (!leaderId) return '暂无'
+ const user = userOptions.value.find(u => u.id == leaderId)
+ return user?.nicke || user?.realName || user?.nickName || user?.username || user?.name || '暂无'
+}
+
+// 部门领导列的formatter
+const formatLeaderCell = (_row: any, _column: any, _value: any) => {
+ return getLeaderNicke(_row.leaderId)
+}
+
// 构建树形选择器的选项
const treeOptions = computed(() => {
const buildOptions = (nodes: DeptItem[], excludeId?: number | string): any[] => {
@@ -347,15 +361,14 @@ const handleTreeReset = () => {
// 加载用户列表(用于选择部门领导)
const loadUsers = async () => {
try {
- // 这里需要根据实际API调整,暂时使用空数组
- // 如果有用户列表API,可以在这里调用
- // const res: any = await userlist({ pageNum: 1, pageSize: 9999 })
- // const data = res?.data ?? res ?? {}
- // const records = data.records || data.list || data.rows || data.items || []
- // userOptions.value = Array.isArray(records) ? records : []
- userOptions.value = []
+ const res: any = await userselect({})
+ // 兼容多种返回格式:res.data 或 res 本身
+ const data = Array.isArray(res?.data) ? res.data : Array.isArray(res) ? res : []
+ userOptions.value = data
} catch (error) {
console.error('load user list error', error)
+ ElMessage.error('加载用户列表失败')
+ userOptions.value = []
}
}
@@ -363,6 +376,11 @@ const loadUsers = async () => {
const loadList = async () => {
loading.value = true
try {
+ // 确保用户列表已加载(用于显示部门领导名称)
+ if (userOptions.value.length === 0) {
+ await loadUsers()
+ }
+
// 构建查询参数,过滤空字符串
const params: any = {
pageNum: pagination.pageNum,
@@ -652,3 +670,4 @@ onMounted(() => {
}
+
diff --git a/rc_autoplc_front/src/views/user/index.vue b/rc_autoplc_front/src/views/user/index.vue
index 62b39fa..279a665 100644
--- a/rc_autoplc_front/src/views/user/index.vue
+++ b/rc_autoplc_front/src/views/user/index.vue
@@ -6,7 +6,7 @@
@@ -172,7 +172,7 @@
:data="deptTreeOptions"
:props="{ value: 'id', label: 'deptName', children: 'children' }"
check-strictly
- placeholder="请选择部门(可选)"
+ placeholder="请选择部门"
clearable
style="width: 100%"
/>
@@ -182,7 +182,7 @@
v-model="form.posId"
filterable
clearable
- placeholder="请选择职位(可选)"
+ placeholder="请选择职位"
style="width: 100%"
>
Date: Tue, 23 Dec 2025 14:02:53 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/business/islandinfo.ts | 39 ++
.../src/api/{ => system}/department.ts | 0
.../src/api/{ => system}/manage-log.ts | 0
.../src/api/{ => system}/position.ts | 0
rc_autoplc_front/src/api/{ => system}/role.ts | 8 +
rc_autoplc_front/src/api/system/user-role.ts | 67 +++
rc_autoplc_front/src/api/{ => system}/user.ts | 0
rc_autoplc_front/src/router/index.ts | 5 +
rc_autoplc_front/src/views/Layout.vue | 6 +-
.../src/views/department/index.vue | 4 +-
.../src/views/manage-log/index.vue | 2 +-
rc_autoplc_front/src/views/position/index.vue | 2 +-
rc_autoplc_front/src/views/role/index.vue | 2 +-
.../src/views/user-role/index.vue | 527 ++++++++++++++++++
rc_autoplc_front/src/views/user/index.vue | 167 +++++-
15 files changed, 819 insertions(+), 10 deletions(-)
create mode 100644 rc_autoplc_front/src/api/business/islandinfo.ts
rename rc_autoplc_front/src/api/{ => system}/department.ts (100%)
rename rc_autoplc_front/src/api/{ => system}/manage-log.ts (100%)
rename rc_autoplc_front/src/api/{ => system}/position.ts (100%)
rename rc_autoplc_front/src/api/{ => system}/role.ts (83%)
create mode 100644 rc_autoplc_front/src/api/system/user-role.ts
rename rc_autoplc_front/src/api/{ => system}/user.ts (100%)
create mode 100644 rc_autoplc_front/src/views/user-role/index.vue
diff --git a/rc_autoplc_front/src/api/business/islandinfo.ts b/rc_autoplc_front/src/api/business/islandinfo.ts
new file mode 100644
index 0000000..fbd1bae
--- /dev/null
+++ b/rc_autoplc_front/src/api/business/islandinfo.ts
@@ -0,0 +1,39 @@
+import request from '@/utils/request'
+
+export function islandInfoadd(data: any) {
+ return request({
+ url: '/islandInfo/add',
+ method: 'post',
+ data,
+ })
+}
+
+export function islandInfodel(id: string | number) {
+ return request({
+ url: `/islandInfo/del/${id}`,
+ method: 'delete',
+ })
+}
+
+export function islandInfoupd(data: any) {
+ return request({
+ url: '/islandInfo/update',
+ method: 'put',
+ data,
+ })
+}
+
+export function islandInfolist(data: any) {
+ return request({
+ url: '/islandInfo/listPage',
+ method: 'get',
+ params: data,
+ })
+}
+
+export function islandInfobyid(id: string | number) {
+ return request({
+ url: `/islandInfo/getById/${id}`,
+ method: 'get',
+ })
+}
\ No newline at end of file
diff --git a/rc_autoplc_front/src/api/department.ts b/rc_autoplc_front/src/api/system/department.ts
similarity index 100%
rename from rc_autoplc_front/src/api/department.ts
rename to rc_autoplc_front/src/api/system/department.ts
diff --git a/rc_autoplc_front/src/api/manage-log.ts b/rc_autoplc_front/src/api/system/manage-log.ts
similarity index 100%
rename from rc_autoplc_front/src/api/manage-log.ts
rename to rc_autoplc_front/src/api/system/manage-log.ts
diff --git a/rc_autoplc_front/src/api/position.ts b/rc_autoplc_front/src/api/system/position.ts
similarity index 100%
rename from rc_autoplc_front/src/api/position.ts
rename to rc_autoplc_front/src/api/system/position.ts
diff --git a/rc_autoplc_front/src/api/role.ts b/rc_autoplc_front/src/api/system/role.ts
similarity index 83%
rename from rc_autoplc_front/src/api/role.ts
rename to rc_autoplc_front/src/api/system/role.ts
index 0431cbc..5bbf493 100644
--- a/rc_autoplc_front/src/api/role.ts
+++ b/rc_autoplc_front/src/api/system/role.ts
@@ -36,4 +36,12 @@ export function rolebyid(id: string | number) {
url: `/role/getById/${id}`,
method: 'get',
})
+}
+
+export function rleselect(data: any) {
+ return request({
+ url: '/role/list',
+ method: 'get',
+ params: data,
+ })
}
\ No newline at end of file
diff --git a/rc_autoplc_front/src/api/system/user-role.ts b/rc_autoplc_front/src/api/system/user-role.ts
new file mode 100644
index 0000000..9d65c25
--- /dev/null
+++ b/rc_autoplc_front/src/api/system/user-role.ts
@@ -0,0 +1,67 @@
+import request from '@/utils/request'
+
+// 新增用户角色关联
+export function userRoleAdd(data: any) {
+ return request({
+ url: '/user-role/add',
+ method: 'post',
+ data,
+ })
+}
+
+// 根据ID删除用户角色关联
+export function userRoleDel(id: string | number) {
+ return request({
+ url: `/user-role/del/${id}`,
+ method: 'delete',
+ })
+}
+
+// 分页查询用户角色关联列表
+export function userRoleList(data: any) {
+ return request({
+ url: '/user-role/listPage',
+ method: 'get',
+ params: data,
+ })
+}
+
+// 根据ID查询用户角色关联
+export function userRoleById(id: string | number) {
+ return request({
+ url: `/user-role/getById/${id}`,
+ method: 'get',
+ })
+}
+
+// 根据角色ID查询关联用户(先封装不调用)
+export function userRoleByRoleId(roleId: string | number) {
+ return request({
+ url: `/user-role/getByRoleId/${roleId}`,
+ method: 'get',
+ })
+}
+
+// 根据角色ID删除所有关联(先封装不调用)
+export function userRoleDelByRoleId(roleId: string | number) {
+ return request({
+ url: `/user-role/delByRoleId/${roleId}`,
+ method: 'delete',
+ })
+}
+
+// 根据用户ID查询关联角色(先封装不调用)
+export function userRoleByUserId(userId: string | number) {
+ return request({
+ url: `/user-role/getByUserId/${userId}`,
+ method: 'get',
+ })
+}
+
+// 根据用户ID删除所有关联(先封装不调用)
+export function userRoleDelByUserId(userId: string | number) {
+ return request({
+ url: `/user-role/delByUserId/${userId}`,
+ method: 'delete',
+ })
+}
diff --git a/rc_autoplc_front/src/api/user.ts b/rc_autoplc_front/src/api/system/user.ts
similarity index 100%
rename from rc_autoplc_front/src/api/user.ts
rename to rc_autoplc_front/src/api/system/user.ts
diff --git a/rc_autoplc_front/src/router/index.ts b/rc_autoplc_front/src/router/index.ts
index ab5d519..b6c6386 100644
--- a/rc_autoplc_front/src/router/index.ts
+++ b/rc_autoplc_front/src/router/index.ts
@@ -32,6 +32,11 @@ const router = createRouter({
name: 'manage-log',
component: () => import('../views/manage-log/index.vue'),
},
+ {
+ path: '/user-role',
+ name: 'user-role',
+ component: () => import('../views/user-role/index.vue'),
+ },
],
},
],
diff --git a/rc_autoplc_front/src/views/Layout.vue b/rc_autoplc_front/src/views/Layout.vue
index df964a6..2a35ff0 100644
--- a/rc_autoplc_front/src/views/Layout.vue
+++ b/rc_autoplc_front/src/views/Layout.vue
@@ -56,6 +56,10 @@
操作日志管理
+
+
+ 用户角色管理
+
@@ -72,7 +76,7 @@
import { ref, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { User, Setting, Avatar, OfficeBuilding, Briefcase, Document, CaretBottom } from '@element-plus/icons-vue'
+import { User, Setting, Avatar, OfficeBuilding, Briefcase, Document, CaretBottom, UserFilled } from '@element-plus/icons-vue'
import { useAuthStore } from '@/stores/auth'
const router = useRouter()
diff --git a/rc_autoplc_front/src/views/department/index.vue b/rc_autoplc_front/src/views/department/index.vue
index a19370f..25c0e66 100644
--- a/rc_autoplc_front/src/views/department/index.vue
+++ b/rc_autoplc_front/src/views/department/index.vue
@@ -205,8 +205,8 @@ import {
departmentadd,
departmentdel,
departtree,
-} from '@/api/department'
-import { userselect } from '@/api/user'
+} from '@/api/system/department'
+import { userselect } from '@/api/system/user'
interface DeptItem {
id?: number | string
diff --git a/rc_autoplc_front/src/views/manage-log/index.vue b/rc_autoplc_front/src/views/manage-log/index.vue
index 8451ae8..d0969b4 100644
--- a/rc_autoplc_front/src/views/manage-log/index.vue
+++ b/rc_autoplc_front/src/views/manage-log/index.vue
@@ -152,7 +152,7 @@ import {
managelogdel,
manageloglist,
managelogupd,
-} from '@/api/manage-log'
+} from '@/api/system/manage-log'
interface LogItem {
id?: string | number
diff --git a/rc_autoplc_front/src/views/position/index.vue b/rc_autoplc_front/src/views/position/index.vue
index 294091b..ab692ac 100644
--- a/rc_autoplc_front/src/views/position/index.vue
+++ b/rc_autoplc_front/src/views/position/index.vue
@@ -127,7 +127,7 @@
import { onMounted, reactive, ref } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { positionadd, positionbyid, positiondel, positionlist, positionupd } from '@/api/position'
+import { positionadd, positionbyid, positiondel, positionlist, positionupd } from '@/api/system/position'
interface PositionItem {
id?: number | string
diff --git a/rc_autoplc_front/src/views/role/index.vue b/rc_autoplc_front/src/views/role/index.vue
index 9e38163..5de6a59 100644
--- a/rc_autoplc_front/src/views/role/index.vue
+++ b/rc_autoplc_front/src/views/role/index.vue
@@ -111,7 +111,7 @@
import { onMounted, reactive, ref } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { roleadd, rolebyid, roledel, rolelist, roleupd } from '@/api/role'
+import { roleadd, rolebyid, roledel, rolelist, roleupd } from '@/api/system/role'
interface RoleItem {
id?: number | string
diff --git a/rc_autoplc_front/src/views/user-role/index.vue b/rc_autoplc_front/src/views/user-role/index.vue
new file mode 100644
index 0000000..2e939c9
--- /dev/null
+++ b/rc_autoplc_front/src/views/user-role/index.vue
@@ -0,0 +1,527 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+ 新增用户角色关联
+
+
+
+
+
+
+
+
+
+ {{ getUserName(scope.row.userId) }}
+
+
+
+
+ {{ getRoleName(scope.row.roleId) }}
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rc_autoplc_front/src/views/user/index.vue b/rc_autoplc_front/src/views/user/index.vue
index 279a665..300e624 100644
--- a/rc_autoplc_front/src/views/user/index.vue
+++ b/rc_autoplc_front/src/views/user/index.vue
@@ -100,9 +100,10 @@
min-width="150"
:formatter="formatCell"
/>
-
+
编辑
+ 分配角色
删除
@@ -213,6 +214,31 @@
+
+
+
+
+
+ {{ role.roleName || role.roleCode }}
+
+
+
+
+
+
@@ -220,9 +246,11 @@
import { onMounted, reactive, ref, computed } from 'vue'
import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
-import { useradd, userbyid, userdel, userlist, userupd } from '@/api/user'
-import { departtree } from '@/api/department'
-import { positionselect } from '@/api/position'
+import { useradd, userbyid, userdel, userlist, userupd } from '@/api/system/user'
+import { departtree } from '@/api/system/department'
+import { positionselect } from '@/api/system/position'
+import { userRoleAdd, userRoleByUserId, userRoleDel } from '@/api/system/user-role'
+import { rleselect } from '@/api/system/role'
interface UserItem {
id?: number | string
@@ -253,6 +281,12 @@ interface PositionItem {
posiCode?: string
}
+interface RoleItem {
+ id?: number | string
+ roleName?: string
+ roleCode?: string
+}
+
const loading = ref(false)
const submitLoading = ref(false)
const tableData = ref
([])
@@ -261,6 +295,12 @@ const deptTreeData = ref([])
const positionOptions = ref([])
const deptMap = ref