Merge remote-tracking branch 'origin/main'

This commit is contained in:
weiweiw 2024-11-08 10:28:22 +08:00
commit cf48732c87
7 changed files with 193 additions and 27 deletions

View File

@ -0,0 +1,18 @@
import request from '@/utils/request'
// 查询【请填写功能名称】列表
export function list() {
return request({
url: '/system/user/getLockUser',
method: 'get'
})
}
// 查询【请填写功能名称】详细
export function delLockUser(data) {
return request({
url: '/system/user/delLockUser',
method: 'post',
data:data
})
}

View File

@ -154,3 +154,16 @@ export function checkPasswordStatus(data) {
})
}
export function confirmPassword(password) {
const data = {
password
}
return request({
url: '/system/user/confirmPassword',
method: 'post',
data:data
})
}

View File

@ -0,0 +1,11 @@
<script setup>
</script>
<template>
</template>
<style scoped lang="scss">
</style>

View File

@ -75,17 +75,17 @@
<el-table v-loading="loading" :data="whitelistList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" label="序号" width="50"/>
<el-table-column label="IP地址" align="center" prop="ipAddress">
<el-table-column label="IP地址" align="center" prop="ipAddress" min-width="120px">
<template slot-scope="scope">
<span> {{scope.row.ipAddress?scope.row.ipAddress:scope.row.ipRangeStart+" - " + scope.row.ipRangeEnd}} </span>
</template>
</el-table-column>
<el-table-column label="开放时间" align="center" prop="ipRangeStart">
<el-table-column label="开放时间" align="center" prop="ipRangeStart" min-width="120px">
<template slot-scope="scope">
<span> {{!scope.row.accessStartTime?"不限时间":parseTime(scope.row.accessStartTime,'{h}:{i}:{s}')+" - " + parseTime(scope.row.accessEndTime,'{h}:{i}:{s}')}} </span>
<span> {{!scope.row.accessStartTime?"不限时间":parseTime(scope.row.accessStartTime)+" - " + parseTime(scope.row.accessEndTime)}} </span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" key="status">
<el-table-column label="状态" align="center" key="status" min-width="20px">
<template slot-scope="scope">
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
@change="handleStatusChange(scope.row)"
@ -170,17 +170,14 @@
</el-radio-group>
<el-row v-if="timeLimit === 'limited'" :gutter="24">
<el-col :span="10">
<el-time-picker
is-range
:editable=false
<el-date-picker
v-model="form.accessStartTime"
type="datetimerange"
value-format="yyyy-MM-dd HH:mm:ss"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
placeholder="选择时间范围"
>
</el-time-picker>
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-col>
</el-row>
@ -472,7 +469,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除这些数据项?').then(function() {
return delWhitelist(ids)
}).then(() => {
this.getList()

View File

@ -1,11 +1,83 @@
<script setup>
</script>
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
size="mini"
@click="handleUpdate"
:disabled="multiple"
>解除锁定
</el-button>
</el-col>
</el-row>
<el-table ref="multipleTable" v-loading="loading" @row-click="handleRowClick" :data="list" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" label="序号" width="50"/>
<el-table-column label="用户名" align="center" prop="userName"/>
<el-table-column label="锁定时长(分钟)" align="center" prop="time"/>
</el-table>
</div>
</template>
<style scoped lang="scss">
</style>
<script>
import { list,delLockUser} from '@/api/system/lockUser'
import { delWhitelist } from '@/api/system/ipWhitelist'
export default {
name: 'LockUser',
data() {
return {
//
loading: true,
//
ids: [],
list:[],
//
multiple: true,
}
},
created() {
this.getList()
},
methods: {
/** 查询列表 */
getList() {
this.loading = true
list().then(response => {
this.list = response.data;
this.loading = false
})
},
handleRowClick(row, column, event) {
const table = this.$refs.multipleTable;
const selectedRows = table.selection;
// Check if the row is already selected
const isRowSelected = selectedRows.includes(row);
if (isRowSelected) {
// If the row is selected, unselect it
table.toggleRowSelection(row, false);
} else {
// If the row is not selected, select it
table.toggleRowSelection(row, true);
}
},
handleUpdate(){
const ids = this.ids
this.$modal.confirm('是否确认解锁这些数据项?').then(function() {
return delLockUser(ids)
}).then(() => {
this.getList()
this.$modal.msgSuccess('解锁成功')
}).catch(() => {
})
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.userName)
this.multiple = !selection.length
},
}
}
</script>

View File

@ -56,7 +56,7 @@
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="confirmPassword"
v-hasPermi="['system:user:edit']"
>修改
</el-button>
@ -108,7 +108,7 @@
<el-table-column label="账号时效" align="center">
<template slot-scope="scope">
<span>{{scope.row.isPermanent==0?"长期账号":"临时账号" }}</span>
<span>{{scope.row.isPermanent==1?"长期账号":"临时账号" }}</span>
</template>
</el-table-column>
@ -124,7 +124,7 @@
</el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template slot-scope="scope" v-if="scope.row.userId !== 1">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
<el-button size="mini" type="text" icon="el-icon-edit" @click="confirmPassword(scope.row)"
v-hasPermi="['system:user:edit']"
>修改
</el-button>
@ -321,7 +321,7 @@ import {
updateUser,
resetUserPwd,
changeUserStatus,
deptTreeSelect, approvalStatus
deptTreeSelect, approvalStatus, confirmPassword
} from '@/api/system/user'
import { getToken } from '@/utils/auth'
import Treeselect from '@riophae/vue-treeselect'
@ -627,6 +627,32 @@ export default {
this.form.password = ''
})
},
confirmPassword(row){
this.$prompt('请输入密码,鉴别用户', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
closeOnClickModal: false,
inputPattern: /^.{8,16}$/,
inputErrorMessage: '用户密码长度必须介于 8 和 16 之间',
inputValidator: (value) => {
// validateNewPassword
const errorMessage=function(error) {
if (error) {
return error.message;
} else {
console.log('验证通过');
}
};
validateNewPassword(null, value, errorMessage);
}
}).then(({ value }) => {
confirmPassword(value).then(response => {
this.$modal.msgSuccess('验证成功')
this.handleUpdate(row)
})
}).catch(() => {
})
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {

View File

@ -62,7 +62,8 @@
import userAvatar from "./userAvatar";
import userInfo from "./userInfo";
import resetPwd from "./resetPwd";
import { getUserProfile } from "@/api/system/user";
import { confirmPassword, getUserProfile } from '@/api/system/user'
import { validateNewPassword } from '@/utils/validate'
export default {
name: "Profile",
@ -76,7 +77,8 @@ export default {
};
},
created() {
this.getUser();
this.confirmPassword();
//this.getUser();
},
methods: {
getUser() {
@ -85,7 +87,34 @@ export default {
this.roleGroup = response.roleGroup;
this.postGroup = response.postGroup;
});
},
confirmPassword(){
this.$prompt('请输入密码,鉴别用户', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
closeOnClickModal: false,
inputPattern: /^.{8,16}$/,
inputErrorMessage: '用户密码长度必须介于 8 和 16 之间',
inputValidator: (value) => {
// validateNewPassword
const errorMessage=function(error) {
if (error) {
return error.message;
} else {
console.log('验证通过');
}
};
validateNewPassword(null, value, errorMessage);
}
}).then(({ value }) => {
confirmPassword(value).then(response => {
this.$modal.msgSuccess('验证成功')
this.getUser()
})
}).catch(() => {
this.$tab.closePage();
})
},
}
};
</script>