From 0082fa417fb2af9add3406bf05ab3e3e45890c34 Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Thu, 12 Jun 2025 14:30:02 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/drone/drone-web-manage
---
src/views/system/user.vue | 353 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 179 insertions(+), 174 deletions(-)
diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index edd9fb3..ffe6b58 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -11,122 +11,47 @@
</el-col>
<el-col :span="19">
<basic-container>
- <avue-crud
- :option="option"
- v-model:search="search"
- :table-loading="loading"
- :data="data"
- ref="crud"
- v-model="form"
- :permission="permissionList"
- @row-del="rowDel"
- @row-update="rowUpdate"
- @row-save="rowSave"
- :before-open="beforeOpen"
- v-model:page="page"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
+ <avue-crud :option="option" v-model:search="search" :table-loading="loading" :data="data" ref="crud"
+ v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
+ :before-open="beforeOpen" v-model:page="page" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
<template #menu-left>
- <el-button
- v-if="permission.user_add && !auditMode"
- type="primary"
- icon="el-icon-plus"
- @click="$refs.crud.rowAdd()"
- >新 增
+ <el-button v-if="permission.user_add && !auditMode" type="primary" icon="el-icon-plus"
+ @click="$refs.crud.rowAdd()">新 增
</el-button>
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- v-if="permission.user_delete && !auditMode"
- @click="handleDelete"
- >删 除
+ <el-button type="danger" plain icon="el-icon-delete" v-if="permission.user_delete && !auditMode"
+ @click="handleDelete">删 除
</el-button>
- <el-button
- type="primary"
- plain
- icon="el-icon-operation"
- v-if="userInfo.role_name.includes('admin') && !auditMode"
- @click="handleAudit"
- >审 核
+ <el-button type="primary" plain icon="el-icon-operation"
+ v-if="userInfo.role_name.includes('admin') && !auditMode" @click="handleAudit">审 核
</el-button>
- <el-button
- type="success"
- plain
- icon="el-icon-check"
- v-if="userInfo.role_name.includes('admin') && auditMode"
- @click="handleAuditPass"
- >通 过
+ <el-button type="success" plain icon="el-icon-check" v-if="userInfo.role_name.includes('admin') && auditMode"
+ @click="handleAuditPass">通 过
</el-button>
- <el-button
- type="danger"
- plain
- icon="el-icon-close"
- v-if="userInfo.role_name.includes('admin') && auditMode"
- @click="handleAuditRefuse"
- >拒 绝
+ <el-button type="danger" plain icon="el-icon-close" v-if="userInfo.role_name.includes('admin') && auditMode"
+ @click="handleAuditRefuse">拒 绝
</el-button>
- <el-button
- type="primary"
- plain
- icon="el-icon-refresh-left"
- v-if="userInfo.role_name.includes('admin') && auditMode"
- @click="handleAuditBack"
- >返 回
+ <el-button type="primary" plain icon="el-icon-refresh-left"
+ v-if="userInfo.role_name.includes('admin') && auditMode" @click="handleAuditBack">返 回
</el-button>
- <el-button
- type="info"
- plain
- v-if="permission.user_role && !auditMode"
- icon="el-icon-user"
- @click="handleGrant"
- >角色配置
+ <el-button type="info" plain v-if="permission.user_role && !auditMode" icon="el-icon-user"
+ @click="handleGrant">角色配置
</el-button>
- <el-button
- type="info"
- plain
- v-if="permission.user_reset && !auditMode"
- icon="el-icon-refresh"
- @click="handleReset"
- >密码重置
+ <el-button type="info" plain v-if="permission.user_reset && !auditMode" icon="el-icon-refresh"
+ @click="handleReset">密码重置
</el-button>
- <el-button
- type="info"
- plain
- v-if="userInfo.role_name.includes('admin') && !auditMode"
- icon="el-icon-setting"
- @click="handlePlatform"
- >平台配置
+ <el-button type="info" plain v-if="userInfo.role_name.includes('admin') && !auditMode" icon="el-icon-setting"
+ @click="handlePlatform">平台配置
</el-button>
- <el-button
- type="info"
- plain
- v-if="userInfo.role_name.includes('admin') && !auditMode"
- icon="el-icon-coordinate"
- @click="handleLock"
- >账号解封
+ <el-button type="info" plain v-if="userInfo.role_name.includes('admin') && !auditMode"
+ icon="el-icon-coordinate" @click="handleLock">账号解封
</el-button>
- <el-button
- type="success"
- plain
- v-if="userInfo.role_name.includes('admin') && !auditMode"
- icon="el-icon-upload"
- @click="handleImport"
- >导入
+ <el-button type="success" plain v-if="userInfo.role_name.includes('admin') && !auditMode"
+ icon="el-icon-upload" @click="handleImport">导入
</el-button>
- <el-button
- type="warning"
- plain
- v-if="userInfo.role_name.includes('admin') && !auditMode"
- icon="el-icon-download"
- @click="handleExport"
- >导出
+ <el-button type="warning" plain v-if="userInfo.role_name.includes('admin') && !auditMode"
+ icon="el-icon-download" @click="handleExport">导出
</el-button>
</template>
<template #tenantName="{ row }">
@@ -141,18 +66,11 @@
<template #userTypeName="{ row }">
<el-tag>{{ row.userTypeName }}</el-tag>
</template>
+
</avue-crud>
<el-dialog title="用户角色配置" append-to-body v-model="roleBox" width="345px">
- <el-tree
- :data="roleGrantList"
- show-checkbox
- check-strictly
- default-expand-all
- node-key="id"
- ref="treeRole"
- :default-checked-keys="roleTreeObj"
- :props="props"
- >
+ <el-tree :data="roleGrantList" show-checkbox check-strictly default-expand-all node-key="id" ref="treeRole"
+ :default-checked-keys="roleTreeObj" :props="props">
</el-tree>
<template #footer>
<span class="dialog-footer">
@@ -171,24 +89,12 @@
</avue-form>
</el-dialog>
<el-dialog title="用户平台配置" append-to-body v-model="platformBox">
- <avue-crud
- :option="platformOption"
- :table-loading="platformLoading"
- :data="platformData"
- ref="platformCrud"
- v-model="platformForm"
- :before-open="platformBeforeOpen"
- v-model:page="platformPage"
- :permission="platformPermissionList"
- @row-update="platformRowUpdate"
- @search-change="platformSearchChange"
- @search-reset="platformSearchReset"
- @selection-change="platformSelectionChange"
- @current-change="platformCurrentChange"
- @size-change="platformSizeChange"
- @refresh-change="platformRefreshChange"
- @on-load="platformOnLoad"
- >
+ <avue-crud :option="platformOption" :table-loading="platformLoading" :data="platformData" ref="platformCrud"
+ v-model="platformForm" :before-open="platformBeforeOpen" v-model:page="platformPage"
+ :permission="platformPermissionList" @row-update="platformRowUpdate" @search-change="platformSearchChange"
+ @search-reset="platformSearchReset" @selection-change="platformSelectionChange"
+ @current-change="platformCurrentChange" @size-change="platformSizeChange"
+ @refresh-change="platformRefreshChange" @on-load="platformOnLoad">
<template #tenantName="{ row }">
<el-tag>{{ row.tenantName }}</el-tag>
</template>
@@ -248,7 +154,10 @@
}
};
return {
- form: {},
+ form: {
+ flightStartTime: null, // 飞行事件开始时间
+ flightEndTime: null, // 飞行事件结束时间
+ },
search: {},
roleBox: false,
excelBox: false,
@@ -286,7 +195,12 @@
lazy: true,
treeLoad: function (node, resolve) {
const parentId = node.level === 0 ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
+ console.log(node,666)
+ const param = {
+ parentId:parentId,
+ level:node.level
+ }
+ getDeptLazyTree(param).then(res => {
resolve(
res.data.data.map(item => {
return {
@@ -308,8 +222,8 @@
},
},
option: {
- height: 'auto',
- calcHeight: 140,
+ // height: 'auto',
+ // calcHeight: 140,
tip: false,
searchShow: true,
searchMenuSpan: 6,
@@ -453,6 +367,7 @@
viewDisplay: false,
rules: [{ required: true, validator: validatePass2, trigger: 'blur' }],
},
+
],
},
{
@@ -460,18 +375,18 @@
prop: 'detailInfo',
icon: 'el-icon-s-order',
column: [
- {
- label: '用户昵称',
- prop: 'name',
- hide: true,
- rules: [
- {
- required: true,
- message: '请输入用户昵称',
- trigger: 'blur',
- },
- ],
- },
+ // {
+ // label: '用户昵称',
+ // prop: 'name',
+ // hide: true,
+ // rules: [
+ // {
+ // required: true,
+ // message: '请输入用户昵称',
+ // trigger: 'blur',
+ // },
+ // ],
+ // },
{
label: '用户姓名',
prop: 'realName',
@@ -569,8 +484,12 @@
type: 'tree',
multiple: true,
dicData: [],
+ // props: {
+ // label: 'title',
+ // },
props: {
- label: 'title',
+ label: 'name',
+ value: 'id',
},
checkStrictly: true,
slot: true,
@@ -582,24 +501,58 @@
},
],
},
- // {
- // label: '所属岗位',
- // prop: 'postId',
- // type: 'tree',
- // multiple: true,
- // dicData: [],
- // props: {
- // label: 'postName',
- // value: 'id',
- // },
- // rules: [
- // {
- // required: true,
- // message: '请选择所属岗位',
- // trigger: 'click',
- // },
- // ],
- // },
+
+ ],
+ },
+ {
+ label: '登录限制',
+ prop: '',
+ icon: 'el-icon-s-custom',
+ column: [
+ {
+ label: '到期时间',
+ prop: 'expireTime',
+ type: 'datetime',
+ format: 'YYYY-MM-DD HH:mm:ss',
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
+ },
+ {
+ label: '次数限制',
+ prop: 'maxLoginNum',
+ type: 'input',
+ },
+
+ {
+ label: '飞行开始时间',
+ prop: 'flightStartTime',
+ type: 'time',
+ format: 'HH:mm',
+ valueFormat: 'HH:mm',
+ rules: [
+ {
+ required: false,
+ message: '请输入飞行开始时间',
+ trigger: 'blur',
+ },
+ ],
+ },
+ {
+ label: '飞行结束时间',
+ prop: 'flightEndTime',
+ type: 'time',
+ format: 'HH:mm',
+ valueFormat: 'HH:mm',
+ rules: [
+ {
+ required: false,
+ message: '请输入飞行结束时间',
+ trigger: 'blur',
+ },
+ ],
+ },
+
+
+
],
},
],
@@ -776,6 +729,7 @@
if (!website.tenantMode) {
this.initData(website.tenantId);
}
+ this.initData(this.form.tenantId);
},
methods: {
nodeClick(data) {
@@ -784,6 +738,7 @@
this.onLoad(this.page);
},
initData(tenantId) {
+ tenantId = '000000';
getRoleTree(tenantId).then(res => {
const column = this.findObject(this.option.group, 'roleId');
column.dicData = res.data.data;
@@ -792,10 +747,10 @@
const column = this.findObject(this.option.group, 'deptId');
column.dicData = res.data.data;
});
- getPostList(tenantId).then(res => {
- const column = this.findObject(this.option.group, 'postId');
- column.dicData = res.data.data;
- });
+ // getPostList(tenantId).then(res => {
+ // const column = this.findObject(this.option.group, 'postId');
+ // column.dicData = res.data.data;
+ // });
},
submitRole() {
const roleList = this.$refs.treeRole.getCheckedKeys().join(',');
@@ -809,9 +764,27 @@
});
},
rowSave(row, done, loading) {
+ // 格式化时间数据
+
+ if (row.flightStartTime && row.flightEndTime) {
+ // 验证 flightEndTime 是否小于 flightStartTime
+ const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
+ const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
+
+ const startTotalMinutes = startHours * 60 + startMinutes;
+ const endTotalMinutes = endHours * 60 + endMinutes;
+
+ if (endTotalMinutes < startTotalMinutes) {
+ this.$message.error('飞行结束时间不能小于飞行开始时间');
+ loading();
+ return;
+ }
+ }
+
row.deptId = func.join(row.deptId);
row.roleId = func.join(row.roleId);
row.postId = func.join(row.postId);
+ row.name = row.realName
add(row).then(
() => {
this.initFlag = false;
@@ -829,9 +802,32 @@
);
},
rowUpdate(row, index, done, loading) {
+ // 格式化时间数据
+ // if (row.flightStartTime) {
+ // row.flightStartTime = this.formatTime(row.flightStartTime);
+ // }
+ // if (row.flightEndTime) {
+ // row.flightEndTime = this.formatTime(row.flightEndTime);
+ // }
+ if (row.flightStartTime && row.flightEndTime) {
+ // 验证 flightEndTime 是否小于 flightStartTime
+ const [startHours, startMinutes] = row.flightStartTime.split(':').map(Number);
+ const [endHours, endMinutes] = row.flightEndTime.split(':').map(Number);
+
+ const startTotalMinutes = startHours * 60 + startMinutes;
+ const endTotalMinutes = endHours * 60 + endMinutes;
+
+ if (endTotalMinutes < startTotalMinutes) {
+ this.$message.error('飞行结束时间不能小于飞行开始时间');
+ loading();
+ return ;
+ }
+ }
+
row.deptId = func.join(row.deptId);
row.roleId = func.join(row.roleId);
row.postId = func.join(row.postId);
+ row.name = row.realName
update(row).then(
() => {
this.initFlag = false;
@@ -1034,8 +1030,7 @@
}).then(() => {
NProgress.start();
exportBlob(
- `/blade-system/user/export-user?${
- this.website.tokenHeader
+ `/blade-system/user/export-user?${this.website.tokenHeader
}=${getToken()}&account=${account}&realName=${realName}`
).then(res => {
downloadXls(res.data, `用户数据表${this.$dayjs().format('YYYY-MM-DD')}.xlsx`);
@@ -1063,6 +1058,7 @@
if (this.form.hasOwnProperty('postId')) {
this.form.postId = func.split(this.form.postId);
}
+
});
}
this.initFlag = true;
@@ -1157,11 +1153,18 @@
this.selectionClear();
});
},
+ formatTime(time) {
+ // 格式化时间为 HH:mm
+ const date = new Date(time);
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ return `${hours}:${minutes}`;
+ },
},
};
</script>
-<style>
+<style lang="scss">
.box {
height: 800px;
}
@@ -1173,4 +1176,6 @@
.box .el-scrollbar__wrap {
overflow: scroll;
}
+
+
</style>
--
Gitblit v1.9.3