用户管理bug修复

This commit is contained in:
Double-_-Z 2025-07-19 15:51:25 +08:00
parent 1f84be4eec
commit 1bce9382fb
3 changed files with 19 additions and 5 deletions

View File

@ -30,6 +30,8 @@ export function resetPwd(ids) {
export function edit(data) { export function edit(data) {
if(data.password) data.password = encrypt(data.password) if(data.password) data.password = encrypt(data.password)
console.log(data);
return request({ return request({
url: 'api/users', url: 'api/users',
method: 'put', method: 'put',

View File

@ -59,7 +59,7 @@
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;">
<el-table-column :show-overflow-tooltip="true" prop="name" align="center" :label="`${crud.title}名称`" /> <el-table-column :show-overflow-tooltip="true" prop="name" align="center" :label="`${crud.title}名称`" />
<el-table-column :show-overflow-tooltip="true" prop="scenicNum" align="center" :label="`${crud.title === '区域' ? '景区' : '人员'}数量`" /> <el-table-column :show-overflow-tooltip="true" :prop="crud.title === '区域'?'scenicNum':'peopleNum'" align="center" :label="`${crud.title === '区域' ? '景区' : '人员'}数量`" />
<el-table-column v-if="checkPer(['admin', 'area:edit', 'area:del'])" label="操作" width="115" align="center" <el-table-column v-if="checkPer(['admin', 'area:edit', 'area:del'])" label="操作" width="115" align="center"
fixed="right"> fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
@ -134,7 +134,7 @@ export default {
// console.log('data',data) // console.log('data',data)
}, },
handleTool(node, data) { handleTool(node, data) {
const id = node.level === 4 ? data.parentId : data.id const id = node.level === 3 ? data.parentId : data.id
this.active = data.id this.active = data.id
console.log(node, 'node', data) console.log(node, 'node', data)
this.$set(this, 'parentArr', [{ this.$set(this, 'parentArr', [{
@ -153,7 +153,7 @@ export default {
}, },
// //
getList(id,{type}){ getList(id,{type}){
if(type === 'area'){ if(type === 'area' || type === "scenic"){
this.crud.url = '/aerocraftAdminApi/emScenic' this.crud.url = '/aerocraftAdminApi/emScenic'
this.crud.query.areaId = id; this.crud.query.areaId = id;
this.crud.form.areaId = id; this.crud.form.areaId = id;

View File

@ -72,7 +72,7 @@
<el-form-item label="景区" prop="scenicId"> <el-form-item label="景区" prop="scenicId">
<el-select v-model="form.scenicId" placeholder="请选择景区"> <el-select v-model="form.scenicId" placeholder="请选择景区">
<el-option v-for="item in scenics" :key="item.name" <el-option v-for="item in scenics" :key="item.name"
:label="item.name" :value="item.id"/> :label="item.name" :value="Number(item.id)"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -327,6 +327,11 @@ export default {
[CRUD.HOOK.afterToCU](crud, form) { [CRUD.HOOK.afterToCU](crud, form) {
this.getRoles() this.getRoles()
this.getAreas() this.getAreas()
if(form.scenicId&&form.areaId){
allScenic({areaId: form.areaId}).then(res=>{
this.scenics = res || [];
})
}
}, },
// //
[CRUD.HOOK.beforeToAdd]() { [CRUD.HOOK.beforeToAdd]() {
@ -336,7 +341,12 @@ export default {
[CRUD.HOOK.beforeToEdit](crud, form) { [CRUD.HOOK.beforeToEdit](crud, form) {
this.roleDatas = [] this.roleDatas = []
form.password = '$123456$'; form.password = '$123456$';
form.roles = form.roles[0].id form.roles = form.roles[0].id;
if(form.scenicId) form.scenicId = Number(form.scenicId);
if(form.qualificationAttachment){
this.form.files = [{url: this.baseApi + form.qualificationAttachment,}]
this.uploadDisabled = true;
}
}, },
// //
[CRUD.HOOK.afterValidateCU](crud) { [CRUD.HOOK.afterValidateCU](crud) {
@ -344,6 +354,8 @@ export default {
const roleItem = this.roles.find(item=>item.id === crud.form.roles); const roleItem = this.roles.find(item=>item.id === crud.form.roles);
crud.form.userType = roleItem.name === '飞行员' ? 1 : 0; crud.form.userType = roleItem.name === '飞行员' ? 1 : 0;
crud.form.roles = [{id:rolesIds}]; crud.form.roles = [{id:rolesIds}];
console.log(crud.form.password);
if(crud.form.password === '$123456$') if(crud.form.password === '$123456$')
delete crud.form.password; delete crud.form.password;
return true; return true;