对接’我的布控的增删查改‘,布控审核送审

This commit is contained in:
jy
2025-05-26 21:03:06 +08:00
parent 64bbcd2a06
commit 65947c2eb4
18 changed files with 3332 additions and 890 deletions

View File

@ -1,6 +1,12 @@
<template>
<div class="login-container">
<el-form class="login-form" ref="loginFromRef" :model="loginForm" :rules="loginRules" @submit.native.prevent>
<el-form
class="login-form"
ref="loginFromRef"
:model="loginForm"
:rules="loginRules"
@submit.native.prevent
>
<div class="title-container">
<h3 class="title">用户登录</h3>
</div>
@ -8,22 +14,41 @@
<span class="svg-container">
<svg-icon icon="user" />
</span>
<el-input placeholder="请输入账号" name="userName" type="text" v-model="loginForm.userName" />
<el-input
placeholder="请输入账号"
name="userName"
type="text"
v-model="loginForm.userName"
/>
</el-form-item>
<el-form-item prop="password1">
<span class="svg-container">
<svg-icon icon="password" />
</span>
<el-input placeholder="请输入密码" name="password" :type="passwordType" v-model="loginForm.password"/>
<el-input
placeholder="请输入密码"
name="password"
:type="passwordType"
v-model="loginForm.password"
/>
<span class="show-pwd">
<svg-icon @click="onChangePwdType" :icon="passwordType === 'password' ? 'eye' : 'eye-open'"/>
<svg-icon
@click="onChangePwdType"
:icon="passwordType === 'password' ? 'eye' : 'eye-open'"
/>
</span>
</el-form-item>
<el-form-item v-if="isShowKaptCha" prop="kaptcha">
<span class="svg-container"><svg-icon icon="kaptcha" /></span>
<el-input @keydown.enter="handleLogin()" v-model="loginForm.kaptcha" placeholder="请输入验证码" name="kaptcha" type="text"/>
<el-input
@keydown.enter="handleLogin()"
v-model="loginForm.kaptcha"
placeholder="请输入验证码"
name="kaptcha"
type="text"
/>
<span @click="getKaptchaImg">
<el-image class="show-kaptcha" :src="kaptchaUrl" fit="cover">
<template #error>
@ -35,12 +60,28 @@
<!---登录按钮-->
<el-form-item style="height: 49px" v-if="!loginDialog">
<el-button @click="handleLogin" type="primary" style="width: 520px; height: 49px" :loading="loading" native-type="submit">登录</el-button>
<el-button
@click="handleLogin"
type="primary"
style="width: 520px; height: 49px"
:loading="loading"
native-type="submit"
>登录</el-button
>
</el-form-item>
<el-form-item class="choosedept-wrap" v-if="loginDialog">
<el-select v-model="deptId" @change="refreshToken" placeholder="请选择部门">
<el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName" :value="item.deptId"></el-option>
<el-select
v-model="deptId"
@change="refreshToken"
placeholder="请选择部门"
>
<el-option
v-for="item in deptList"
:key="item.deptId"
:label="item.deptName"
:value="item.deptId"
></el-option>
</el-select>
</el-form-item>
</el-form>
@ -49,7 +90,7 @@
<script>
export default {
name: "login",
name: "login"
};
</script>
<script setup>
@ -78,21 +119,27 @@ const isShowKaptCha = ref(false);
// 验证规则
const loginRules = ref({
userName: [{ required: true, trigger: "blur", message: "用户名为必填项" }],
password: [{ required: true, trigger: "blur", validator: validatePassword() }],
kaptcha: [{ required: true, trigger: "blur", message: "验证码为必填项" }]
userName: [{ required: true, trigger: "blur", message: "用户名为必填项" }],
password: [
{ required: true, trigger: "blur", validator: validatePassword() }
],
kaptcha: [{ required: true, trigger: "blur", message: "验证码为必填项" }]
});
const handleClose = () => {};
const refreshToken = (e) => {
store.dispatch("user/refreshToken", { deptId: e, jwtToken: authorization.value}).then((res) => {
loading.value = false;
store.commit("user/setDeptId", e);
// window.location.href = '/'// 登录后操作
router.push("/");
}).catch(() => {
loading.value = false;
});
store
.dispatch("user/refreshToken", { deptId: e, jwtToken: authorization.value })
.then((res) => {
loading.value = false;
store.commit("user/setDeptId", e);
// window.location.href = '/'// 登录后操作
router.push("/");
})
.catch(() => {
loading.value = false;
});
};
// 处理密码框文本显示状态
const passwordType = ref("password");
@ -112,30 +159,37 @@ const handleLogin = () => {
loginFromRef.value.validate((valid) => {
if (!valid) return false;
loading.value = true;
store.dispatch("user/login", loginForm.value).then((res) => {
loading.value = false;
// 登录后操作
if (res.deptList.length === 1) {
window.location.href = '/'
} else {
deptList.value = [...res.deptList];
loginDialog.value = true;
authorization.value = res.jwtToken;
ElNotification({title: "提示",message: "请选择部门",duration: 3000});
}
}).catch(() => {
loading.value = false;
});
store
.dispatch("user/login", loginForm.value)
.then((res) => {
loading.value = false;
// 登录后操作
if (res.deptList.length === 1) {
window.location.href = "/";
} else {
deptList.value = [...res.deptList];
loginDialog.value = true;
authorization.value = res.jwtToken;
ElNotification({
title: "提示",
message: "请选择部门",
duration: 3000
});
}
})
.catch(() => {
loading.value = false;
});
});
};
const logout = () => {
store.dispatch("user/logout");
};
onMounted(() => {
});
onMounted(() => {});
const getKaptchaImg = () => {
const res =`${process.env.VUE_APP_GATEWAY_BASE_URL}/mosty-api/mosty-base/kaptcha?date=` + new Date();
const res =
`${process.env.VUE_APP_GATEWAY_BASE_URL}/mosty-api/mosty-base/kaptcha?date=` +
new Date();
kaptchaUrl.value = res;
};
</script>