用户新增编辑、初始化密码
parent
9130cfeb91
commit
3bdc9f80ac
|
@ -1,163 +1,237 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="display: flex;justify-content: center">
|
<div style="display: flex; justify-content: center">
|
||||||
<div style="width: 600px;text-align: center;border: 1px solid #e6e6e6;margin-top:40px;padding:10px;">
|
<div
|
||||||
<div class="trial-myinfo-head" style="font-size: 30px;line-height: 120px;">
|
style="
|
||||||
|
width: 600px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid #e6e6e6;
|
||||||
|
margin-top: 40px;
|
||||||
|
padding: 10px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="trial-myinfo-head"
|
||||||
|
style="font-size: 30px; line-height: 120px"
|
||||||
|
>
|
||||||
<!-- 首次登录修改密码 -->
|
<!-- 首次登录修改密码 -->
|
||||||
{{ $t('recompose:title:init') }}
|
{{ $t("recompose:title:init") }}
|
||||||
</div>
|
</div>
|
||||||
<el-form ref="passwordForm" v-loading="loading" label-position="right" :model="password" :rules="passwordFormRules" label-width="120px">
|
<el-form
|
||||||
|
ref="passwordForm"
|
||||||
|
v-loading="loading"
|
||||||
|
label-position="right"
|
||||||
|
:model="password"
|
||||||
|
:rules="passwordFormRules"
|
||||||
|
label-width="120px"
|
||||||
|
>
|
||||||
<!-- 用户名 -->
|
<!-- 用户名 -->
|
||||||
<el-form-item :label="$t('recompose:form:userName')" prop="NewUserName">
|
<el-form-item :label="$t('recompose:form:userName')" prop="NewUserName">
|
||||||
<el-input v-model="password.NewUserName" />
|
<el-input v-model="password.NewUserName" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 旧密码 -->
|
<!-- 旧密码 -->
|
||||||
<el-form-item :label="$t('recompose:form:oldPassword')" prop="OldPassWord">
|
<el-form-item
|
||||||
<el-input v-model="password.OldPassWord" type="password" show-password auto-complete="new-password" />
|
:label="$t('recompose:form:oldPassword')"
|
||||||
|
prop="OldPassWord"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="password.OldPassWord"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
auto-complete="new-password"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 新密码 -->
|
<!-- 新密码 -->
|
||||||
<el-form-item :label="$t('recompose:form:newPassword')" prop="NewPassWord">
|
<el-form-item
|
||||||
<el-input v-model="password.NewPassWord" type="password" show-password auto-complete="new-password" />
|
:label="$t('recompose:form:newPassword')"
|
||||||
|
prop="NewPassWord"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="password.NewPassWord"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
auto-complete="new-password"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 确认密码 -->
|
<!-- 确认密码 -->
|
||||||
<el-form-item :label="$t('recompose:form:confirmPassword')" prop="ConfirmPassWord">
|
<el-form-item
|
||||||
<el-input v-model="password.ConfirmPassWord" type="password" show-password auto-complete="new-password" />
|
:label="$t('recompose:form:confirmPassword')"
|
||||||
</el-form-item>
|
prop="ConfirmPassWord"
|
||||||
<el-form-item style="text-align:right">
|
|
||||||
<!-- 取消 -->
|
|
||||||
<el-button
|
|
||||||
size="small"
|
|
||||||
@click="cancel"
|
|
||||||
>
|
>
|
||||||
{{ $t('recompose:button:cancel') }}
|
<el-input
|
||||||
|
v-model="password.ConfirmPassWord"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
auto-complete="new-password"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 检验码 -->
|
||||||
|
<el-form-item
|
||||||
|
:label="$t('trials:researchForm:form:checkCode')"
|
||||||
|
prop="CheckCode"
|
||||||
|
:maxlength="10"
|
||||||
|
>
|
||||||
|
<el-input v-model="password.CheckCode" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="text-align: right">
|
||||||
|
<!-- 取消 -->
|
||||||
|
<el-button size="small" @click="cancel">
|
||||||
|
{{ $t("recompose:button:cancel") }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 保存 -->
|
<!-- 保存 -->
|
||||||
<el-button
|
<el-button type="primary" size="small" @click="save">
|
||||||
type="primary"
|
{{ $t("recompose:button:save") }}
|
||||||
size="small"
|
|
||||||
@click="save"
|
|
||||||
>
|
|
||||||
{{ $t('recompose:button:save') }}
|
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { modifyPassword } from '@/api/admin.js'
|
import { modifyPassword } from "@/api/admin.js";
|
||||||
import md5 from 'js-md5'
|
import md5 from "js-md5";
|
||||||
import {mapMutations} from "vuex";
|
import { mapMutations } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
password: {
|
password: {
|
||||||
NewUserName: null
|
NewUserName: null,
|
||||||
},
|
},
|
||||||
passwordFormRules: {
|
passwordFormRules: {
|
||||||
NewUserName: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
|
NewUserName: [
|
||||||
OldPassWord: [{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' }],
|
|
||||||
NewPassWord: [
|
|
||||||
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
|
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
trigger: 'blur',
|
message: this.$t("common:ruleMessage:specify"),
|
||||||
validator: this.$validatePassword
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
OldPassWord: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("common:ruleMessage:specify"),
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
NewPassWord: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("common:ruleMessage:specify"),
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
trigger: "blur",
|
||||||
|
validator: this.$validatePassword,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
ConfirmPassWord: [
|
ConfirmPassWord: [
|
||||||
{ required: true, message: this.$t('common:ruleMessage:specify'), trigger: 'blur' },
|
{
|
||||||
]
|
required: true,
|
||||||
|
message: this.$t("common:ruleMessage:specify"),
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
CheckCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t("common:ruleMessage:specify"),
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
userId: null,
|
userId: null,
|
||||||
loading: false
|
loading: false,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$set(this.password, 'NewUserName', this.$route.query.userName)
|
this.$set(this.password, "NewUserName", this.$route.query.userName);
|
||||||
if (!this.password.NewUserName) {
|
if (!this.password.NewUserName) {
|
||||||
// 该页面只提供给首次进入系统的用户使用
|
// 该页面只提供给首次进入系统的用户使用
|
||||||
this.$alert(this.$t('recompose:message:warning'))
|
this.$alert(this.$t("recompose:message:warning"));
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations({ setLanguage: 'lang/setLanguage' }),
|
...mapMutations({ setLanguage: "lang/setLanguage" }),
|
||||||
async logout() {
|
async logout() {
|
||||||
var loginType = zzSessionStorage.getItem('loginType')
|
var loginType = zzSessionStorage.getItem("loginType");
|
||||||
await this.$store.dispatch('user/logout')
|
await this.$store.dispatch("user/logout");
|
||||||
if (loginType) {
|
if (loginType) {
|
||||||
this.$router.push(`/login?loginType=${loginType}`)
|
this.$router.push(`/login?loginType=${loginType}`);
|
||||||
} else {
|
} else {
|
||||||
this.$router.push(`/login`)
|
this.$router.push(`/login`);
|
||||||
}
|
}
|
||||||
this.$i18n.locale = 'zh'
|
this.$i18n.locale = "zh";
|
||||||
this.setLanguage('zh')
|
this.setLanguage("zh");
|
||||||
this.$updateDictionary()
|
this.$updateDictionary();
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
this.$refs.passwordForm.validate(valid => {
|
this.$refs.passwordForm.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.password.NewPassWord !== this.password.ConfirmPassWord) {
|
if (this.password.NewPassWord !== this.password.ConfirmPassWord) {
|
||||||
// 两次密码输入不一致
|
// 两次密码输入不一致
|
||||||
this.$alert(this.$t('recompose:message:passwordDiffer'))
|
this.$alert(this.$t("recompose:message:passwordDiffer"));
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const param = {
|
const param = {
|
||||||
NewUserName: this.password.NewUserName,
|
NewUserName: this.password.NewUserName,
|
||||||
NewPassWord: md5(this.password.NewPassWord),
|
NewPassWord: md5(this.password.NewPassWord),
|
||||||
OldPassWord: md5(this.password.OldPassWord)
|
OldPassWord: md5(this.password.OldPassWord),
|
||||||
}
|
};
|
||||||
this.loading = true
|
this.loading = true;
|
||||||
modifyPassword(param).then(res => {
|
modifyPassword(param)
|
||||||
this.loading = false
|
.then((res) => {
|
||||||
|
this.loading = false;
|
||||||
if (res.IsSuccess) {
|
if (res.IsSuccess) {
|
||||||
// 修改成功,请重新登录账号
|
// 修改成功,请重新登录账号
|
||||||
this.$message.success(this.$t('recompose:message:updatedSuccessfully'))
|
this.$message.success(
|
||||||
|
this.$t("recompose:message:updatedSuccessfully")
|
||||||
|
);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.logout()
|
this.logout();
|
||||||
}, 500)
|
}, 500);
|
||||||
}
|
|
||||||
}).catch(() => { this.loading = false })
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.$refs['passwordForm'].resetFields()
|
this.$refs["passwordForm"].resetFields();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.reset-wrapper {
|
.reset-wrapper {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
.reset-wrapper .el-page-header {
|
.reset-wrapper .el-page-header {
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
border: 1px solid #ebeef5;
|
border: 1px solid #ebeef5;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
.reset-wrapper .box-wrapper {
|
.reset-wrapper .box-wrapper {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.is-error{
|
.is-error {
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
input:-webkit-autofill {
|
input:-webkit-autofill {
|
||||||
-webkit-text-fill-color: #ededed !important;
|
-webkit-text-fill-color: #ededed !important;
|
||||||
box-shadow: 0 0 0px 1000px transparent inset !important;
|
box-shadow: 0 0 0px 1000px transparent inset !important;
|
||||||
background-color:transparent;
|
background-color: transparent;
|
||||||
background-image: none;
|
background-image: none;
|
||||||
transition: background-color 50000s ease-in-out 0s;
|
transition: background-color 50000s ease-in-out 0s;
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
background-color:transparent;
|
background-color: transparent;
|
||||||
caret-color: #fff;
|
caret-color: #fff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
<el-radio-group
|
<el-radio-group
|
||||||
v-model="user.IsZhiZhun"
|
v-model="user.IsZhiZhun"
|
||||||
@change="OrgnizationTypeChanged"
|
@change="OrgnizationTypeChanged"
|
||||||
|
:disabled="IsZhiZhunDisabled"
|
||||||
>
|
>
|
||||||
<el-radio :label="true">{{
|
<el-radio :label="true">{{
|
||||||
$t("system:userlist:title:Internal")
|
$t("system:userlist:title:Internal")
|
||||||
|
@ -124,11 +125,11 @@
|
||||||
}}</el-radio>
|
}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item
|
<el-form-item :label="$t('system:userlist:table:OrganizationName')">
|
||||||
v-show="user.IsZhiZhun === false"
|
<el-input
|
||||||
:label="$t('system:userlist:table:OrganizationName')"
|
v-model="user.OrganizationName"
|
||||||
>
|
:disabled="user.IsZhiZhun === true"
|
||||||
<el-input v-model="user.OrganizationName" />
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
|
@ -276,8 +277,29 @@ export default {
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
type: 0, // 1为编辑,0为新增
|
type: 0, // 1为编辑,0为新增
|
||||||
IsCanConnectInternet: true, // 是否连接互联网
|
IsCanConnectInternet: true, // 是否连接互联网
|
||||||
|
hospitalName: null, // 医院名称
|
||||||
|
IsZhiZhunDisabled: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
"user.UserTypeId": {
|
||||||
|
handler() {
|
||||||
|
if (this.user.UserTypeId) {
|
||||||
|
let name = this.getUserType(this.user.UserTypeId);
|
||||||
|
if (["PM", "PI", "SR", "OA"].includes(name)) {
|
||||||
|
this.user.IsZhiZhun = true;
|
||||||
|
this.user.OrganizationName = this.hospitalName;
|
||||||
|
return (this.IsZhiZhunDisabled = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.user.IsZhiZhun = null;
|
||||||
|
this.user.OrganizationName = null;
|
||||||
|
this.IsZhiZhunDisabled = false;
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getUserTypeList();
|
this.getUserTypeList();
|
||||||
if (this.userId !== "") {
|
if (this.userId !== "") {
|
||||||
|
@ -289,12 +311,17 @@ export default {
|
||||||
this.getInfo();
|
this.getInfo();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getUserType(id) {
|
||||||
|
let obj = this.userTypeOptions.find((item) => item.Id === id);
|
||||||
|
return obj.UserTypeShortName;
|
||||||
|
},
|
||||||
// 获取医院信息
|
// 获取医院信息
|
||||||
async getInfo() {
|
async getInfo() {
|
||||||
try {
|
try {
|
||||||
let res = await getHospital();
|
let res = await getHospital();
|
||||||
if (res.IsSuccess) {
|
if (res.IsSuccess) {
|
||||||
this.IsCanConnectInternet = res.Result.IsCanConnectInternet;
|
this.IsCanConnectInternet = res.Result.IsCanConnectInternet;
|
||||||
|
this.hospitalName = res.Result.HospitalName;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
@ -352,7 +379,11 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
OrgnizationTypeChanged(val) {
|
OrgnizationTypeChanged(val) {
|
||||||
|
if (val) {
|
||||||
|
this.user.OrganizationName = this.hospitalName;
|
||||||
|
} else {
|
||||||
this.user.OrganizationName = "";
|
this.user.OrganizationName = "";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue